Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.

Slides:



Advertisements
Similar presentations
Basics of Database Programming with VB6
Advertisements

Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
1.NET Web Forms DataGrid © 2002 by Jerry Post. 2 Data Grid Has Many Uses  The grid uses HTML tables to display multiple rows of data. It is flexible.
Keys, Referential Integrity and PHP One to Many on the Web.
With Microsoft Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Creating Custom Reports. 2 Design and create a custom report You can easily create custom reports based on a table or query. There are seven sections.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Using Objects and Properties
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
Visual Basic Database Access BICS546. Microsoft Universal Data Access OLE DB: The OLE database protocol –Allows a program to access information in any.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab10 Interacting with Data (Database Management)
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Component 8, Slide 1 CP2030 Visual basic for C++ Programmers, ‘The VB Team’ Copyright © University of Wolverhampton CP2030 Visual Basic For C++ Programmers.
Introduction To Form Builder
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Chapter 8 Relational Databases ActiveX Database Controls 8 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Access Tutorial 10 Automating Tasks with Macros
Chapter 10 - VB.Net by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
CSS/417 Introduction to Database Management Systems Workshop 2.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 6 – Designing.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Binding Basics.
June 23, 2001Database Creation Review and Exercises1 Database Creation Review 10: :30 Team Building Exercise ……………………….. John 10: :30 Database.
Why are Databases Better than Files? Multiple users can all use the same database, and have access to the current, up to the minute values for the data.
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
Microsoft Access 2013 ®® Tutorial 10 Automating Tasks with Macros.
There are seven main components of a database in Access 2000: Tables. Use tables to store database information. Forms Use forms to enter or edit the information.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
® Microsoft Access 2010 Tutorial 10 Automating Tasks with Macros.
Introduction to a Database Defining a database Database window in Access The six items in window: Tables, Queries Forms, Reports, Macros, Modules.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
1 Lesson 18 Managing and Reporting Database Information Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
DATABASE SYSTEM VB LINK TO MS-SQL. 2 Visual ProgrammingChapter 6 Select Project -> Component.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
Visual Basic Database Access
VB 2010 Pertemuan 10.
Microsoft Access 2013 Bobby Wan.
Objectives Create an action query to create a table
Brief description on how to navigate within this presentation (ppt)
VISUAL BASIC INTRODUCTION TO DATA CONNECTIVITY.
CIS16 Application Programming with Visual Basic
Database Applications
Working With Databases
Chapter 10 Accessing Database Files
Presentation transcript:

Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San Diego

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Ch12: Advanced Data Handling  Write database app. with DB Grid control  Database validation and error-trapping  Locate database records using criteria  Define tables, dynasets, and snapshots  Create database indexes  Create a dynaset using SQL

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Displaying Data in Grids  Using a grid control –Add data control to a form. –Project/Components to add M.S. Data Bound Grid control to toolbox. –Put Dbgrid on form. –Retrieve fields into grid: right-click and then choose Retrieve Fields –Modify grid's properties: Right-click and select Properties

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Displaying Data in Grids (Revised Procdure) (1)  Add new components to the toolbox: –Select Project, Components –Locate and check Microsoft ADO Data Control 6.0 (OLEDB) and Microsoft DataGrid Control 6.0 (OLEDB); close dialog box  Add ADO data control to form & name it adodatbooks  Add DataGrid to form and name it dbgridBooks

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Displaying Data in Grids (Revised Procdure) (2)  Set up Data Source: –Right-click the data control and select ADODC Properties –Click General tab, Click Use Connection String option button –Click Provider tab & select Microsoft Jet 3.51 OLE DB Provider –Click Next button –On the Connection tab, browse to select RnRBooks.mdb

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Displaying Data in Grids (Revised Procdure) (3)  Set up the Data Source continued: –Click the Test Connection button. Dialog box should appear indicating connection succeeded. –Close Data Link Properties dialog box –Click the RecordSource tab; select 2- adCmdTable for Command Type –Select Books from the Table or Stored Procedure drop down list –Close the Property Pages dialog box  Continue with textbook: “ Set the Properties of the Grid ”

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Displaying Record Number & Count  Display record number and record count with RecordCount and AbsolutePosition properties intCurrentRecord = datBooks.Recordset.AbsolutePosition + 1  If at BOF or EOF, AbsolutePosition is 0

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Opening the Database  VB automatically opens a database that has a data control on a form  The open occurs after form load  Use the Refresh method to open a database manually in the Form_Load event procedure  Use the data control’s Reposition event to display the current record number

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Validation and Error Trapping  Lock text boxes by setting their Locked property to True; unlock with False  Usually, you lock the primary key field of a database unless you are adding a record  The Validate event is a good place to check a field’s value  Set the Causes Validation property to True to perform lost focus validation on a field (default is True)

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Trapping Program Errors  Errors may be trapped asynchronously  Visual Basic generates an error number when an error occurs  To handle errors, you must –Turn on error handling feature: On Error... –Create error handling code –Determine what is to be done afterwards

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill The Err Object  The Err object holds info about error that just occurred  Err.Source holds the source of the error  Err.Number holds the error number  Err.Description contains error description  You can raise an error condition--turn on an error--with: Err.Raise Number:=xx

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Coding Error-Handling Routines  On Error statement designates error handler  Code to handle errors follows line label  Line label appears on line by itself and ends with a colon  A Case statement works well to sort out errors with a "switchboard"  Continue execution with Resume statement  Exit statement leaves procedure early

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Recordsets  VB supports three kinds of recordsets: –Table recordset—data from a single table –Dynaset—temporary dataset from a table or query that can be updated –Snapshot—dynaset that cannot be updated  Recordset property set at design time or run time  Search for records with FindFirst, FindLast, FindNext, or FindPrevious methods  Form: datControl.Recordset.Findxxxx criteria where criteria is the search criteria

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Reordering a Table Recordset  By switching indexes, you can view a dynaset or table in different orders  One index displays records in PK order, while another might display records in Title order  Form: datacontrol.Recordset.Index = “Fieldname” where Fieldname is one of the fields  Set to data entry order with: datacontrol.Recordset.Index = “”

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Working with Database Fields  Refer to DB field this way: 1.datControl.Recordset!LastName 2.datControl.Recordset(“LastName”)  Refer to DB field this way: datControl.Recordset(“Pub Date”) Or datControl.Recordset![Pub Date]

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Creating a New Dynaset  Dynaset may be a table or multiple, joined tables  VB uses Structured Query Language (SQL) to create dynasets  SQL is world-wide database access standard  Set the RecordSource property to a SQL string and use Refresh to execute query

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Hands on Programming Example