以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 这串代码的 源表是SAP领料数据 但是导出的表格不是它的数据 是main 为什么? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=97601) |
-- 作者:yuyan -- 发布时间:2017/3/15 14:37:00 -- 这串代码的 源表是SAP领料数据 但是导出的表格不是它的数据 是main 为什么? Dim dlg As new SaveFileDialog
dlg.FileName = "SAP领料" If dlg.ShowDialog = DialogResult.OK Then Dim str_oleConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FileSys.GetParentPath(dlg.FileName) & ";Extended Properties=dBASE IV;" Dim ole_conn As New System.Data.OleDb.OleDbConnection(str_oleConn) Try ole_conn.Open() Dim str As String = "" For Each c As Col In CurrentTable.cols str &= c.name & " char(16)," Next output.show(str) Dim cmd1 As New System.Data.OleDb.OleDbCommand("Create Table" & FileSys.GetName(dlg.FileName) & " (" & str.Trim(",") & ")", ole_conn) cmd1.ExecuteNonQuery() For Each r As Row In CurrentTable.rows str = "" For Each c As Col In CurrentTable.cols str &= "\'" & r(c.name) & "\'," Next Dim cmd2 As New System.Data.OleDb.OleDbCommand("Insert Into " & FileSys.GetName(dlg.FileName) & " values (" & str.Trim(",") & ")", ole_conn) output.show(str) cmd2.ExecuteNonQuery() Next msgbox("保存成功") Catch ex As Exception MessageBox.Show(ex.Message) Finally ole_conn.Close() End Try End If |
-- 作者:有点蓝 -- 发布时间:2017/3/15 15:16:00 -- CurrentTable改为具体的表,比如tables("SAP领料") |