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=SQLOLEDB.1;Password=root;
Persist Security Info=True;
User ID=sqladmin;
Initial Catalog=Northwind;Data Source=BIZSNA;"
cnn1.open 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
rstSchema.MoveNext
Loop
rstSchema.Close
cnn1.Close
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,
cmlimnet
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=SQLOLEDB.1;Password=root;
Persist Security Info=True;
User ID=sqladmin;
Initial Catalog=Northwind;Data Source=BIZSNA;"
cnn1.open 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
rstSchema.MoveNext
Loop
rstSchema.Close
cnn1.Close
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,
cmlimnet