Connecting Using RDO
In this exercise, you will use Visual Basic and RDO to connect to a data source and return rows of data. A partial solution has been provided for you.
* To open the RDO Project
- Start Visual Basic 5.0 .
- From the New Project dialog, select the Existing tab.
- Locate WA\Practice\Ch07\Lab7RDO.vbp and click Open .
- When prompted to add the project to Visual SourceSafe, click No .
- From the Project menu, click References .
Note that a reference has been made to the Microsoft Remote Data Object 2.0 library.
* To connect to an ODBC data source - Open the code window for the cmdConnect_Click event.
- Add the following RDO connection code:
Set cn = New rdoConnection With cn .Connect = "DSN=nwind" .EstablishConnection rdDriverNoPrompt, False End With
* To fill the textboxes with data from the employees table - From the object list box on the code window choose (General) .
- From the procedure list box on the code window choose FillTextBoxes .
- In this procedure, you will write the code to fill the text boxes as in the example below.
txtFirstName.Text = rs!firstname txtLastname.Text = rs!lastname
* To examine the code in the rest of the application - Review the code in the cmdFirst , cmdPrevious , cmdNext and cmdLast click events.
- Save your work.
- Start and test the application.