?
Solved

VB.net Access  check if column type is AutoNumber

Posted on 2013-06-25
5
Medium Priority
?
538 Views
Last Modified: 2013-07-01
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
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39275939
If you bind this datatable to a grid, do you see any column that may indicate autonumber?
0
 

Author Comment

by:Murray Brown
ID: 39277005
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...
0
 

Author Comment

by:Murray Brown
ID: 39277012
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
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39278202
That may work if you do a select on the table itself (not getschematable) and then check the AutoIncrement property of the column in datatable.
0
 

Author Closing Comment

by:Murray Brown
ID: 39289796
Thanks very much
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses
Course of the Month10 days, 17 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question