Accessing Microsoft Access Table Definition

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top