When I am running this code its also retrieving some other fields which are not present in a table. How to overcome this?
Dim conn As New OleDb.OleDbConnection 'Create a connection string for an Access database Dim strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\check\a.mdb" 'Attach the connection string to the connection object conn.ConnectionString = strConnectionString 'Open the connection conn.Open() Dim Restrictions() As String = {Nothing, Nothing, selected, Nothing} 'selected contains the name of table
Dim CollectionName As String = "Columns" Dim dt As DataTable = conn.GetSchema(CollectionName, Restrictions) For Each TableRow As DataRow In dt.Rows ComboBox1.Items.Add(TableRow.Item("COLUMN_NAME"))
The additional schema which is also retrieved are.
- ID
- Date create
- Date update
- Id
- Lv
- Name
- parent Id
- Type
- GUID
- Id
And are 6 more columns, original schema is of only 5 columns