On Wiring Up an ADO Data Control - Creating a New ODBC DSN (Page 3 of 4 )
In this case we will be using the Oracle 10G XE database; therefore the appropriate driver will be used. Make sure that the Oracle server is running. Click on the Add... button. This brings up the list of database drivers on this machine that allow you to connect to various databases. We will be using the Oracle XE driver that was registered when Oracle 10G XE was installed. Choose this driver by highlighting it as shown. Then click on the Finish button.

This brings up the Oracle ODBC Drive Configuration window. As usual you need to provide a name for this DSN. Here it is called DSNOraXe. For the TNS (Transparent Network Substrate) Service Name provide the name of the server, XE. The description, which is optional, may be used to refer to the machine on which the server is running. For UserID, you must use HR, assuming you have established a user of the HR database by that name. If you have not taken this step, you must do so before proceeding further. This is described in the Oracle 10G XE installation manual, or in the online help. You may also read the previous article on the DevShed.com site.
You need not configure other items in this window. Click on the OK button to proceed to the next step. This will bring up the login for the Oracle 10 XE server. Once the proper information is entered, the DSN gets into the list of DSNs in the System DSN list in the ODBC Data Source Administrator window.

Creating a Connection String for the Use Connection String Option
This will be created inside the Visual Basic Program and will be described there.
Testing Connectivity with a Visual Basic Project
Start a standard EXE Visual Basic project. From the Project --> Components menu you can access the Components window. The ADODC ActiveX control (msadodc.ocx) can be added to the tool box from the Components window by scrolling down and choosing the control as shown.

The project has three forms, each appropriately named as shown. On each of the forms an ADODC control is placed by double clicking the control's icon in the toolbox.

Testing the DataLink File
Right click the ADODC control and choose ADODC properties from the drop-down; you can bring up its property pages as shown. The picture shows both the form and the Property pages for the control. With the radio button choose the Use Data link file; you may browse to the AccLink.udl file created earlier as shown.

In the Authentication tab accept the default. In the RecordSource tab choose the Orders table as shown and click OK.

For the textbox on the form set the DataSource property to adodc1 and the DataField property to ShipName. When you run this form after choosing it from the Project -->AdoConn Properties... drop-down, you will see the following displayed (record position changed for this picture).

Next: Testing the ODBC Data Source Name Option >>
More Database Articles
More By Jayaram Krishnaswamy