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