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 OLEDBatabase 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
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 OLEDBatabase 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: