FoxTable停止工作问题,如下图:
这个问题出现的频率越来越多,让人找不到问题所在,很多时候重启FT解决,经常这样使我对FT产生了放弃的想法,比如下面的代码,单独运行正常;一字不动,放在另一个项目中就会使FT停止工作。
关键是有问题FT你要报错误在哪儿,不能”停止工作“完事!
此主题相关图片如下:ft停止工作.png
Dim dlg As new SaveFileDialog
dlg.FileName = CurrentTable.Name
If dlg.ShowDialog = DialogResult.OK Then
If FileSys.FileExists(dlg.FileName) = True
FileSys.DeleteFile(dlg.FileName,2,2)
End If
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 & "] ntext,"
Next
Dim cmd1 As New System.Data.OleDb.OleDbCommand("Create Table " & FileSys.GetName(dlg.FileName) & " (" & str.Trim(",") & ")", ole_conn)
cmd1.ExecuteNonQuery()
Dim r As Row = CurrentTable.Current
Dim cname As String
str = ""
For Each c As Col In CurrentTable.cols
str &= "'" & r(c.name) & "',"
cname &= "," & c.Name
Next
Dim cmd2 As New System.Data.OleDb.OleDbCommand("Insert Into " & FileSys.GetName(dlg.FileName) & " (" & cname.trim(",") & ") values (" & str.Trim(",") & ")", ole_conn)
cmd2.ExecuteNonQuery()
msgbox("保存成功")
ole_conn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
ole_conn.Close()
End Try
End If
[此贴子已经被作者于2017/2/4 10:42:44编辑过]