Question Getting secondary indexes of an Access Table through GetOleDbSchemaGuid.

mmustaros

New member
Joined
Sep 4, 2010
Messages
2
Programming Experience
10+
Hi.

I want to find the secondary indexes of an Access Table.

To obtain the fields of Primary key, I write next code.

Dim cn As New OleDbConnection()
Dim schemaTable As DataTable
Dim i As Integer

Dim sBD as String = "C:\MMBNet\Data2\Pe1.mdb"
Dim sConex as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sBD &";Jet OLEDB:Database Password = wxyz"

cn.ConnectionString = sConex
cn.Open()

SchemaTable = cn.GetOleDbSchemaTable System.Data.OleDb.OleDbSchemaGuid.Primary_Keys, _
New Object() {Nothing, Nothing, "TPF30CLI"})

Dim RowCount As Int32
For RowCount = 0 To SchemaTable.Rows.Count - 1
listBox1.Items.Add("2 " & SchemaTable.Rows(RowCount)!COLUMN_NAME.ToString)
Next RowCount


Previous code works fine, but now I want to get Names and fields of secondary indexes.

I tried next code:

SchemaTable = cn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.dbinfoliterals, New String() {Nothing, Nothing, "TPF30CLI"})

For RowCount = 0 To SchemaTable.Rows.Count - 1
listBox1.Items.Add(SchemaTable.Rows(RowCount)!COLUMN_NAME.ToString)
Next RowCount


but it do nothing.

Please any help.
Thanks
mmustaros
 
Last edited:
Hello.

(Thanks jmcilhinney, but dbInfoLiterals was a mistake).

I put next code

SchemaTable = cn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Indexes, New String() {Nothing, Nothing, "TPF30CLI"})

For RowCount = 0 To SchemaTable.Rows.Count - 1
listBox1.Items.Add(SchemaTable.Rows(RowCount)!COLUMN_NAME.ToString)
Next RowCount


And returns nothing.
Any idea.
 
Back
Top