|
||
|
Most of what was accomplished with DAO is accomplished in ADO by replacing the basic Data Control (DAO) with the new ADO Data Control (ADODC) that comes with VB 6.
Those with VB 5 will need to download the ISG Data Control for ADO from the:
| ||
|
Another thing to learn about is the Visual Basic project references. These are definitions. Without them VB does not know what ADODB.Recordset means for instance.
When you put an ADO Data Control on a form, VB usually includes all the references you will need. However, you may have to add them yourself at times. To do this:
| ||
|
Adding the ADO Data Control to a project is similiar:
The icon for the ADO Data Control will then appear in the toolbox window and you will be able to place it on a form. | ||
|
When doing the demos with the DAO Control, one property that was not touched upon was the Connect property. It wasn't necessary because the Data Control defaulted to Access type databases which were the only database types in the demos.
In ADO however, this becomes a requirement because there is no default. In ADO it is called a connection string and minimally contains the type of database to be connected to (Provider) and the name of the file (Data Source or Database Name). There are other things that may be included in the connection string, like Password, but they are not required. Examples are:
Data Source = C:\begdb\Biblio.mdb | ||
| When working with a control we simply add these strings in the control's properties. Enter these values in the following tabbed property pages for the ADO Data Control (ADODC): | ||
![]() | ||
| To get to these pages right click on the ADODC control and select Properties. In the General Tab make sure the radio button is on Use Connection String and click on Build: | ||
![]() | ||
|
Once you have your connection string set you should now be able to pick the table that you want in the database. So go to the RecordSource Tab in Property Pages.
Refer to the following illustration to first choose 2 - adCmdTable from the dropdown combobox. Then you should see a list of the tables in the database and be able to select one. | ||
![]() | ||
| If you have the ISG Data Control for ADO click [here] to see how to set the connection string. |