Access删除不了数据,为何?(我修改论坛某高手的代码)
本帖最后由 KLU3K 于 2009-8-10 00:39 编辑在代码和数据库都在附件中。
删除不掉我选择的数据。奇怪啊
提示错误在72行:
$addfld.execute($sQuery)^ ERROR
不想下附件的看一下删除部分的代码:Func del()
$Strn = GUICtrlRead(GUICtrlRead($ListView1))
$Strnspin = StringSplit($Strn, "|")
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$iMsgBoxAnswer = MsgBox(266276, "删除确认", "你确定要删除【" & $Strnspin & "】这条记录?")
Select
Case $iMsgBoxAnswer = 6 ;是
$Strn = GUICtrlRead(GUICtrlRead($ListView1))
$Strnspin = StringSplit($Strn, "|")
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$sQuery = "DELETE FROM " & $tblname & " IN '" & $mdb_data_path & "' WHERE Date" & " = " & $Strnspin
MsgBox(0, "Debug", $sQuery)
$addfld.execute($sQuery)
$addfld.close
MsgBox(4096, "删除成功:", "【"& $Strnspin & "】这条记录删除成功!!!")
Case $iMsgBoxAnswer = 7 ;否
du()
EndSelect
EndFunc ;==>del $addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
连续2次打开同一个数据库? :face (17):
删除了也不行啊 楼上能具体些么? DATA字段的内容要用引号括起来 $sQuery = "DELETE FROM " & $tblname& " WHERE Date" & " = '" & $Strnspin&"'"
页:
[1]