GetOleDbSchemaTable Table Column Schema from JET MS Access

Public Sub GetDatabaseTableColumns()
Try
Dim table As DataTable
Using cn As New OleDb.OleDbConnection(My.Settings.conStrOneWay)
cn.Open()
Dim restrictionValues As String() = New String() {Nothing, Nothing, "Quotes", Nothing}
table = cn.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Columns, restrictionValues)
cn.Close()
End Using

Call DisplayData(table)

Catch ex As Exception
Throw ex
End Try
End Sub

Private Sub DisplayData(ByVal table As DataTable)
For i = 0 To table.Rows.Count - 1
Dim msg As String = table.Rows(i)!COLUMN_NAME.ToString & vbTab & table.Rows(i)!DATA_TYPE.ToString
Console.WriteLine(msg)
Debug.Print(msg)
Next i
End Sub

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: