Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using the Data Access Controls: DAO & ADO Presented by Victor Matos.

Similar presentations


Presentation on theme: "Using the Data Access Controls: DAO & ADO Presented by Victor Matos."— Presentation transcript:

1 Using the Data Access Controls: DAO & ADO Presented by Victor Matos

2 VB & Database Systems zNew Technologies in VB6 ActiveX Data Objects (ADO) DataList and DataCombo replace DBList and DBCombo. The DataGrid is the successor to DBGrid. The Chart control is now data bound. New Hierarchical FlexGrid The Data Report is a new ActiveX designer Data Formatting and Data Validation DHTML and Data Access

3 DAO Control zPrevious versions of VB used the Data Access Object Control: DAO. zDAO is/was particularly good for MS- Access and MS-SQL-Server databases. zDAO has limitations in dealing with non- Microsoft databases.

4 DAO Connections VB- Program DAO Control MS Jet Engine MS-Access Database ORACLE ODBC SQLPassThrough-Mode

5 Terminology zRECORDSET yRepresents the data in a table, or the result of a SQL select statement. yYou can use recordsets to view, update, or delete data in the base tables.

6 Using the Old DAO Control Data Aware Text Boxes Data Aware OLE Container DAO Data Access Control MOVE: First, Last, Next, Previous

7 Making the DAO Application zMake the following form Control Names: txtFirstName txtLastName txtID lblID olePhoto datEmployee

8 datEmployee: DAO zChange the following attributes of datEmployee yName:datEmployee yDatabaseName:Nwind.mdb yRecordSource:Employees yCaption:Employees

9 Data Aware Controls zChange the Text-boxes and OLE box to:

10 The New ADO Control zVB6 recommends using the ADO control instead of the older DAO-RDO. zADO works well with local desktop DBMS software and remote database servers. zYou need the Professional/Enterprise edition of VB.

11 ADO Control & OLE DB

12 Example1. ADO + JetEngine zUse the ADO control to show records in the MS-Access BIBLIO.MDB database. zUse the native “Jet-Engine” connection. Data Aware Text Boxes ADO Control

13 Example1. ADO + JetEngine zObjects and Property Settings for the Authors Project.

14 Example1. ADO + JetEngine zConnectionString yThe ConnectionString can be set up at design and run time. yIt tells VB how to get to the database. yThe Options are: xJet Engine OLE DB (native to Microsoft Access) xODBC (generic)

15 Example1. ConnectionString zAdjust the property page of adoAuthor Set CommadType: 2-adCmdTable Click on ConnectionString button

16 Example1. ‘Use Connection String’ Click on Option3 Push BUILD

17 Example1. Jet 3.51 Provider Pick: JET 3.51 OLE DB Provider Click on Next

18 Example1. Database Name Click on … button to locate file Select Biblio.mdb Test the connection, then push OK.

19 Example1. RecordSource Push … on the adoAuthor RecordSource attribute Choose the Authors table Apply, then OK

20 Example1. Save & Run zSave all your files. zExecute the application.

21 Example2. Using ODBC zOpen Data Base Connectivity (ODBC) is a software protocol to allow client applications -written in any language- to gain access to a database system.

22 Example2. ODBC zMaking ODBC connections in VB is a convenient practice because the steps involved are the same for all types of compliant database systems. ODBC VB Program Databases MS-Access MS-SQL Server Oracle Sybase IBM - DB2 SAP... ADO

23 Example2. ODBC Data Source zOdbc Data Source A named Open Database Connectivity (ODBC) resource that specifies ythe location, ydriver type, and yother parameters needed by an ODBC driver to access a database.

24 Example2. Adding an ODBC Data Source zBring the ODBC-Administrator from the Control Panel Choose the 32bit ODBC manager

25 Example2. Adding an ODBC Data Source Click on the Add button Select driver

26 Example2 1- Name the source: myBiblioLink 2- Add a comment 3- Click Select 4- Locate the file 5- Push OK


Download ppt "Using the Data Access Controls: DAO & ADO Presented by Victor Matos."

Similar presentations


Ads by Google