How to Use an Adode VB6 Connection to List Tables in a Database

An Adobe VB6 connection links to a specified database and server, which then allows you to list all of the tables in the database. You use this type of query to view the tables in an administration or database maintenance application, or verify tables exist before you query the data.

Instructions

    • 1

      Open the Visual Studio software on your desktop from the Windows program menu. Open your Adobe project to view the code.

    • 2

      Create the connection variable that contains the database information such as the name, server, and your username and password. Add the following code to create the connection:

      Dim olecon As New OleDb.OleDbConnection
      dbProvider =

      olecon.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:/customers.mdb"

      In this example, the database source is an Access database and the file name is "customers.mdb."

    • 3

      Retrieve a list of the tables. The following code uses the connection object to retrieve a list of tables.

      query = "SELECT MSysObjects.Name AS table_name
      FROM MSysObjects"
      command = New OleDbCommand(query, olecon)

Related Searches:

References

Comments

Related Ads

Featured