以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [分享]将项目的所有数据表(包括外部数据源)打包成ACC (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=71500) |
-- 作者:yyzlxc -- 发布时间:2015/7/13 9:02:00 -- [分享]将项目的所有数据表(包括外部数据源)打包成ACC 可以将包括外部数据源在内的所有数据表,生成一个ACC文件。 Dim t As String = format(Date.now(),"yyyyMMddHHmmss") \'全部数据加载 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 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 = ProjectPath & "数据源"& t &".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 = ProjectPath & "数据源"& t &".mdb" ex.Export() Else Dim ex As New Exporter ex.SourceTableName = dt.Name ex.filepath = ProjectPath & "数据源"& t &".mdb" ex.Export() End If Next MessageBox.Show("数据源已保存在项目所在文件夹内") End If
|
-- 作者:y2287958 -- 发布时间:2015/7/13 9:32:00 -- Syscmd.Project.ToAccess()不也行吗 |
-- 作者:yyzlxc -- 发布时间:2015/7/13 9:39:00 -- Syscmd.Project.ToAccess()只能生成一个包含所有内部表的Access文件,不包括外部表。 |