当我运行此代码时,它还会检索表中不存在的其他一些字段。如何克服这个?
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"))
还检索到的附加模式是。
还有6列,原始架构只有5列