可以生成名为数据源的ACC文件,保存在本地e:\Data\文件夹,按钮代码。
'加载全部表
For Each dt As DataTable In DataTables
DataTables( dt.Name ).LoadFilter = ""
DataTables( dt.Name ).Load
DataTables( dt.Name ).Save()
Next
Dim Result As DialogResult
Result = MessageBox.Show("数据表加载完成,是否生成ACC?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.no Then
Vars("_jssj") = Date.Now
Return
Else
'生成ACC
For Each dt As DataTable In DataTables
If (DataTables( dt.Name ).basetable.Columns.Contains("_Sortkey")) = True
Dim colNames As String = "[_Identify],[_Locked],[_Sortkey]"
For Each c As DataCol In dt.DataCols
colNames += "," & c.Name
Next
Dim ex As New Exporter
ex.SourceTableName = dt.Name
ex.Fields = colNames
ex.filepath = "e:\Data\数据源.mdb"
ex.Export()
ElseIf (DataTables( dt.Name ).basetable.Columns.Contains("_Identify")) = True
Dim colNames As String = "[_Identify],[_Locked]"
For Each c As DataCol In dt.DataCols
colNames += "," & c.Name
Next
Dim ex As New Exporter
ex.SourceTableName = dt.Name
ex.Fields = colNames
ex.filepath = "e:\Data\数据源.mdb"
ex.Export()
Else
Dim ex As New Exporter
ex.SourceTableName = dt.Name
ex.filepath = "e:\Data\数据源.mdb"
ex.Export()
End If
Next
MessageBox.Show("数据源已保存到 e:\Data文件夹")
End If