How to get MS Database Schema!
Posted on 2006-06-11
Hi, What i am trying to achieve is to be able to get a microsoft database schema based only on database and its location. The purpose of this application is to be able to allow the user to spesify a database as shown underneath and based on this information to be able to get a list of available tables that are in the database. unfortunately i get run time errors.
my code is as follows:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\vb.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection()
myConnection.ConnectionString = connString
' create a data adapter
' ' Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from person", myConnection)
1* TextBox1.Text = myConnection.GetSchema().ToString
Whenever i run the application i get the following error: "Invalid operation. The connection is closed at position 1*."
Does anyone know how to get a schema, the solution doesn't have to be based on the above code , Thanks in advance!