Howdy, Stranger!

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


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,


  • Justin BibJustin Bib USAMember Posts: 0

    ___ \ \ free ebooks and video tutorials about < Ruby, Python, Go, Visual Basic, Objective-C, C++, JavaScript, R, PL/SQL, Perl, C, C#, PHP, Swift, Assembly, MATLAB, Java, Delphi, Visual Basic .NET, Scratch Alice, Fortran, Julia, Rust, SAS, Crystal, ABAP, Clojure, VBScript, Ada, COBOL, Hack, Kotlin, LabVIEW, D, Transact-SQL, Scheme, Lisp, ML, Bash, Lua, Scala, Prolog, Apex, Awk, FoxPro, Dart, F#, Erlang, Logo /> _

Sign In or Register to comment.