このコードを実行すると、テーブルに存在しない他のフィールドも取得されます。どうすればこれを克服できますか?
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}
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"))
取得される追加の列は次のとおりです。
1.ID
2.日付作成
3.日付更新
4.Id
5.Lv 6.名前
7.
親 ID
8.
タイプ 9.GUID
10.Id
...そしてさらに6つ。元のスキーマは 5 つのフィールドのみで構成されています。