How to get primary and indexex using ADO in VB6

Dear All,

I wanna to get primark key and indexes from table in
Ms SQL 7.0 using ADO in VB. I can get the primary and indexes name using below code but I cant get the column name for primary and indexes.

Set cnn1 = New ADODB.Connection
strCnn = "Provider=SQEDB.1;Password=root;
Persist Security Info=True;
User ID=sqladmin;
Initial Catalog=Northwind;Data Source=BIZSNA;" strCnn

Set rstSchema = cnn1.OpenSchema(adSchemaIndexes)
Do Until rstSchema.EOF
Debug.Print rstSchema!TABLE_CATALOG
Debug.Print rstSchema!TABLE_SCHEMA
Debug.Print rstSchema!INDEX_NAME
Debug.Print rstSchema!Type
Debug.Print rstSchema!TABLE_NAME
How to get column name for primary key and indexes?
How to differentiate whether it is primary key or indexes?
Thank you very much.

Best Regard,
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!