J
Joe
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.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
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.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