Requires Free Membership to View
Dim DT As DataTable
Dim SchemaGUID As OleDb.OleDbSchemaGuid
Dim MyRow As DataRow
Dim MyCol As DataColumn
ODC.Open()
DT = ODC.GetOleDbSchemaTable(SchemaGUID.Tables, Nothing)
Label1.Text = ""
For Each MyCol In DT.Columns
If Not DT.Rows(0).IsNull(MyCol.ColumnName) Then
Label1.Text += MyCol.ColumnName & " : "
End If
Next
Label1.Text += vbCrLf
For Each MyRow In DT.Rows
For Each MyCol In DT.Columns
If Not MyRow.IsNull(MyCol.ColumnName) Then
Label1.Text += MyRow(MyCol.ColumnName) & " : "
End If
Next
Label1.Text += vbCrLf
Next
That should give you what you need to know. Just fill a combo box with the TABLE_NAME from each row in the DataTable.
The GetOleDbSchemaTable method of the OleDbConnection object provides schema data in ADO.NET. You provide this method with a GUID retrieved by calling the appropriate method of the OleDb.OleDbSchemaGuid object. Using these objects, you can retrieve a wealth of information about a database schema.
This was first published in October 2002

Join the conversationComment
Share
Comments
Results
Contribute to the conversation