Re: How to determine if a table has a column that is autoincrement(Identity)?
From: Miha Markic [MVP C#] (miha)
Date: 06/03/04
- Next message: Miha Markic [MVP C#]: "Re: How to delete thousands of rows? It's VERY slow?"
- Previous message: Miha Markic [MVP C#]: "Re: Best Practice: Table Primary Key"
- In reply to: Joe: "How to determine if a table has a column that is autoincrement(Identity)?"
- Next in thread: Joe: "Re: How to determine if a table has a column that is autoincrement(Identity)?"
- Reply: Joe: "Re: How to determine if a table has a column that is autoincrement(Identity)?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 3 Jun 2004 07:58:19 +0200
Hi Joe,
What database are we talking about?
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"Joe" <anon03@comcast.net> wrote in message
news:fc5825fe.0406021922.ec5b4c8@posting.google.com...
> Hi All,
>
> I am trying to find out how to determine if a table that I am
> working with contains a column that is an identity column (ie,
> has autoincrement set to true). I am working in C# and I'm
> already using the GetOleDbSchemaTable method to get the schema
> for the table I am interested in. However, this DataTable that
> I get back does give me the names of the columns but it does
> not tell me if a column is an identity column, or at the very
> least I don't know where to look for it in the Datatable. This
> is the call I am using:
>
> DataTable dtCols = conn.GetOleDbSchemaTable(
> OleDbSchemaGuid.Columns,
> new Object[]{null, null, sTableName, null});
>
> Now I've seen posts and visted websites that say you can get
> the autoincrement/identity flag by accessing the Columns data
> member as such:
>
> dtCols.Columns[i].AutoIncrement
>
> Now, although this flag is there, it seems to be associated
> with some meta-data column. In fact, all of the Columns that
> are in the DataTable(dtCols, the table that I get from the
> call above) seem to be associated with the table's meta-data
> (like, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME). Its the Rows
> data member that contains information on the columns of the
> table but I can't find any reference to the autoincrement or
> identity flag. I was hoping it would be in this DataTable
> since I could make one function call and get all I need.
>
> Can someone please tell me how I can programatically get this
> flag or tell me where to find it? Thanks in advance.
>
> Sincerely,
> Joe
- Next message: Miha Markic [MVP C#]: "Re: How to delete thousands of rows? It's VERY slow?"
- Previous message: Miha Markic [MVP C#]: "Re: Best Practice: Table Primary Key"
- In reply to: Joe: "How to determine if a table has a column that is autoincrement(Identity)?"
- Next in thread: Joe: "Re: How to determine if a table has a column that is autoincrement(Identity)?"
- Reply: Joe: "Re: How to determine if a table has a column that is autoincrement(Identity)?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|