Solved

VB.net Access  check if column type is AutoNumber

Posted on 2013-06-25
5
512 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:murbro
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

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

Author Comment

by:murbro
Comment Utility
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:murbro
Comment Utility
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 500 total points
Comment Utility
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:murbro
Comment Utility
Thanks very much
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now