Visual Basic and ADO

ADO and SQL Server

ADO and SQL Server

Visual Basic and ADO

With Microsoft® Visual Basic®, the ADO object model is integrated into the development environment. This allows you to use features such as drop-down lists of ADO properties and methods as you enter code, and internally, high-level access to OLE DB functionality.

Visual Basic version 6.0 includes:

  • The ADO Data Control and other ADO/OLE DB capable data bound controls.

  • The Data Environment Designer, an interactive graphical tool that allows for the building of ADO connections and commands. It provides a programmatic interface to the data access objects in a project.

  • Dynamic data binding, which allows the run-time setting of a DataSource property of a data consumer, such as a DataGrid control, to a data source, such as the ADO Data Control.

To use ADO to access SQL Server 2000 data in a Visual Basic application

  1. Reference ADO from your Visual Basic Project.

  2. Set the Provider property of the Connection object by specifying Sqloledb.

To reference ADO from a Visual Basic project

  1. In Visual Basic, on the Project menu, click References.

  2. Select Microsoft ActiveX Data Objects 2.6 Library. Verify that at least the following libraries are also selected:
    • Visual Basic for Applications

    • Visual Basic runtime objects and procedures

    • Visual Basic objects and procedures

    • OLE Automation

The library for ADO is msado15.dll and the program ID (ProgID) is ADODB.

For more information about the use of connection properties for SQLOLEDB, see Connecting to a SQL Server Data Source.

For more information about Visual Basic, see the MSDN Library at Microsoft Web site.