SQL的DELETE语句无法执行?
y102 2007-02-01 03:37:58 SQL的DELETE语句无法执行?下面是原程序:
Dim strPath As String = Application.StartupPath() & "\" '方法3
Dim strDataFile As String = strPath & "MyCase.xls"
Dim constring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDataFile & ";Extended Properties=Excel 8.0;Persist Security Info=False"
Try
mycon = New OleDbConnection(constring)
mycon.Open()
Catch ex As Exception
MsgBox("Xls 连接失败" & ex.ToString)
End Try
Dim Str As String
Dim mycom As OleDbCommand
Str = "Insert Into [Dir2$] Values('1','<文件夹>')"
mycom = New OleDbCommand(Str, mycon) '成功
mycom.ExecuteNonQuery()
Str = "DELETE FROM [Dir2$] WHERE 大小 = '<文件夹>'"
mycom = New OleDbCommand(Str, mycon) '不成功
mycom.ExecuteNonQuery()