On Wiring Up an ADO Data Control
(Page 1 of 4 )
ActiveX Data Control is Microsoft's most versatile pre-.NET Framework control that superseded the earlier DAO and RDO controls. Other third party data controls like the Oracle control were also used, but their support within the Visual Basic program was not as good. This tutorial is about connecting the ADODC control to a data source.
This ActiveX control provides three options for connecting to a data source and this article discusses all of them. The emphasis of this tutorial is not so much on using this control when it is connected, but rather on the configuration of the control to make a connection.
Three ways to connect an ADO control to a data source
The Property pages of an ADO control shows that there are three options for connecting to a database. These are:
- Using a DataLink file
- Using an ODBC Source name
- Using a Connection String
The Datalink file and the ODBC Source name can be created outside the VB environment using other tools. The connection string and the ODBC Source name options can be configured from inside the VB Program. Of course, all of these options depend on the data source that is going to be used. The providers of data, the middle men in this connection effort, are different for different data sources as will be seen shortly.
In the case of the DataLink option, the connection will be made to an MS Access Jet Database; the ODBC Source name will use an Oracle 10G XE database on the local machine, and the connection string option will make a connection to a SQL 2005 Server on the network. A Visual Basic Standard EXE project with three forms will be used to elucidate the details. Since the proverbial proof of the pudding is in its eating, some minimal use of the control after it gets connected to the data will also be demonstrated.
Next: Preparatory Steps >>
More Database Articles
More By Jayaram Krishnaswamy