By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Accessing Microsoft Access Table Definition

P: n/a
I am trying to get the Table Column definitions from a Microsoft Access 2000 database (*.mdb). Using VB with System.Windows.Forms.Form I do the following

Dim OpenDBDialog As New OpenFileDialo
OpenDBDialog.Filter = "Database files (*.mdb)|*.mdb
OpenDBDialog.RestoreDirectory = Tru
If OpenDBDialog.ShowDialog() = DialogResult.OK The
Dim ColumnName As Strin
Dim ii As Intege
Dim jj As Intege
Dim oConn As OleDbConnectio
Dim schemaTable As DataTabl
Dim schemaColumn As DataTabl
Dim sConn As Strin
Dim TableName As Strin

sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + OpenDBDialog.FileNam
oConn = New OleDbConnection(sConn
oConn.Open(
schemaTable = oConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
New Object() {Nothing, Nothing, Nothing, "TABLE"}
For ii = 0 To schemaTable.Rows.Count - 1 'Iterate over table
TableName = schemaTable.Rows(ii).Item(2
schemaColumn = oConn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns,
New Object() {Nothing, Nothing, schemaTable.Rows(ii).Item(2), Nothing}
For jj = 0 To schemaColumn.Rows.Count - 1 'Iterate over column
ColumnName = schemaColumn.Rows(jj).Item(3
Nex
Nex

Now what I would like is to get the column's Data Type (e.g., AutoNumber, Number, Text, Memo, Date/Time, etc. I think I can decode two or three items from the Columns ItemArray but this does not seem straight forward. I would think that there would be a single value which indicates the Data Type but I have not been able to find it. Anyone know

Michael
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.