hi
I have some code of ADO.net to dynamically detect the database schema, what I need is how to get Unique columns constraints and Primary key constraints using SqlConnection GetSchema() method.
thanks

Welcome waleed_cs2000,
GetSchema() Method return a DataTable instance.
Use "IndexColumns" argument to list the primary key meta info.

var lst =  dc.Connection.GetSchema("IndexColumns") ;

Welcome waleed_cs2000,
GetSchema() Method return a DataTable instance.
Use "IndexColumns" argument to list the primary key meta info.

var lst =  dc.Connection.GetSchema("IndexColumns") ;

thanks a lot , that helped me, but is there any way to differntiate unique columns from primary keys in this method?

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.