SqlServer: How to know if a a column is a primary key ?

L

Lloyd Dupont

I have a database-generic application.
CommandBuilder is not satisfactory.
I try to generate my own command automatically but:

I can't get PrimaryKey information !

I create a
IDbCommand cmd;.
cmd.CommandText = SELECT * FROM Table
IDataReader dr = cmd.ExecuteReader(CommmandBehavior.SchemaOnly)

and then I analyse
dr.GetSchemaTable()

the column "IsKey" is always set to DBNull.Value, at last on the PocketPC
(with the compact framework)

I know there is plenty of meta table in SqlServer.
which one should I query to get primary key information ?
 
L

Lloyd Dupont

don't worry, found it.
see my previous similar post ...

anyway, still a bug in the schema table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top