Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net Access check if column type is AutoNumber

Hi

I used the following code to bind data about the VB.net Access tables in my database.
I noticed that the DATA_TYPE column shows 3 for integer values. I am trying to find which columns are Autoumber. How do I do this?

        Dim connection As New OleDbConnection(Globals.ThisAddIn.oRIGHT.lblConnectionString.Text)
        connection.Open()

        Dim mySchema As DataTable = TryCast(connection, OleDbConnection).GetOleDbSchemaTable(OleDbSchemaGuid.Columns, New [Object]() {Nothing, Nothing, "Transactions"})

        Me.DataGridView3.DataSource = mySchema
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

If you bind this datatable to a grid, do you see any column that may indicate autonumber?
Avatar of Murray Brown

ASKER

Hi

I already did that and I can't seem to find anything useful.
The DATA_TYPE column has 3 for Integers and AutoNumbers,
but that doesn't help.
ORDINAL_POSITION as you know doesn't cover all bases.
IS_NULLABLE also doesn't distinguish an integer from an AutoNumber.

So I am at a loss...
In a previous question relating to this I was given the following link
http://msdn.microsoft.com/en-us/library/system.data.datacolumn.autoincrement.aspx
but am not sure how to apply this
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks very much