G
Guest
I'm using the following code to obtain information about any table in a
database. Now _schemaTable contains the info about the table and one of its
fields is "IsKey" which as far as I know should identify the columns that are
the primary keys in the table. Unfortunately "IsKey" is always false for me
even though some columns are the primary keys. Why is that? Is there
something I'm doing wrong or something that I'm not doing? Some of the other
information in the _schemaTable such as "ColumnName" is correct for each of
the columns in the table. The following is the code sample: Thanks for help
in advance.
Tom.
System.Data.IDataReader reader;
this._Command.CommandText = "SELECT * FROM [" + tableName + "]";
reader = _Command.ExecuteReader(System.Data.CommandBehavior.SingleRow);
_schemaTable = reader.GetSchemaTable();
database. Now _schemaTable contains the info about the table and one of its
fields is "IsKey" which as far as I know should identify the columns that are
the primary keys in the table. Unfortunately "IsKey" is always false for me
even though some columns are the primary keys. Why is that? Is there
something I'm doing wrong or something that I'm not doing? Some of the other
information in the _schemaTable such as "ColumnName" is correct for each of
the columns in the table. The following is the code sample: Thanks for help
in advance.
Tom.
System.Data.IDataReader reader;
this._Command.CommandText = "SELECT * FROM [" + tableName + "]";
reader = _Command.ExecuteReader(System.Data.CommandBehavior.SingleRow);
_schemaTable = reader.GetSchemaTable();