Hi guys, I'm finding myself in a little trouble. I've tried to google this problem, but without much success. Hopefully its something simple I'm missing and someone will be able to help me.
I'm writing a little program that will synchronize two access database schema's. It works, to a point.
My problem is, I'm unable to identify whats an AutoNumber and whats a Long Integer.
Both DATA_TYPES are 3, same with COLUMN_FLAGS, both are 90.
a Long Integer that doesn't allow nulls COLUMN_FLAGS will be 90 and its DATA_TYPE will be 3
an AutoNumber will also be COLUMN_FLAGS = 90 and DATA_TYPE = 3
all other fields I can test by are also identical. etc NUMERIC_PRECISION
Here same code to populate datagrid that lists DATA_TYPES
(just fix the connection string and make sure you point to the correct table)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim str As String = "Provider=Microsoft.jet.oledb.4.0;Data Source=C:\Temp\Master.mdb"
Dim conn As New OleDb.OleDbConnection
conn.ConnectionString = str
' Open a connection
conn.Open()
'Call GetOleDbSchemaTable
Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, New Object() {Nothing, Nothing, "TableTest"})
' Attach data row to the grid and close the connection
DataGrid1.DataSource = schemaTable
conn.Close()
End Sub
Obliviously this is problematic when I iterating though my collections and start building my SQL Query Strings. Since a table can only have 1 AutoNumber field.
How do I identify whats an AutoNumber field and whats a Long Integer that doesn't allow nulls?
any and all help will be appreciated!
Regards.