Dim dlg As new OpenFileDialog
dlg.Filter = "数据库|*.mdb"
If dlg.ShowDialog = DialogResult.OK Then
Dim dict As new Dictionary(of String,String)
dict.Add("基本信息表","出厂编号")
dict.Add("XXX表","XX编号")
Connections.Add("test","Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dlg.FileName & ";Persist Security Info=False")
Dim cmd As New SQLCommand
cmd.C
Dim dt As DataTable
Dim lst As List(Of String)
lst = Connections("test").GetTableNames
For Each nm As String In lst
If dict.ContainsKey(nm)
Dim bh As String = dict(nm)
cmd.CommandText = "SeLECT * From {" & nm & "}"
dt = cmd.ExecuteReader()
For Each dr As DataRow In dt.DataRows
If DataTables(nm).Find(bh & "= '" & dr(bh) & "'") Is Nothing Then
Dim nr As DataRow = DataTables(nm).AddNew()
For Each dc As DataCol In dt.DataCols
nr(dc.name) = dr(dc.name)
Next
End If
Next
End If
Next
Connections.Delete("test")
End If