无法从指定的数据中删除?
删除数据时提示以下内容:
Error Type:
Microsoft JET Database Engine (0x80004005)
无法从指定的数据表中删除。
/sysadmin/product/deletepro.asp, line 30
我查不到原因,请帮忙。以下是deletepro.asp中的代码:
id=request( "ID ")
Set conn = Server.CreateObject( "ADODB.Connection ")
conn.Open mallDSN
Set rs = server.CreateObject( "ADODB.Recordset ")
sql = "select id,picture from product where id in ( " & SQLString(id) & ") "
rs.Open sql, conn, adOpenStatic
If not rs.eof then
rs.close
if request( "step ")= "delCheck " then
sql= "delete from product where id in ( " & SQLString(id) & ") "
else
sql = "delete from product where id= " & SQLString(id) & " "
end if
application.lock
conn.execute sql //估计是执行到这一步的时候出错的
application.unlock
我现在把我的CONN代码也贴一些上来,看看是不是这儿错了:
'数据库连接串
'mallDSN= "DBQ=data/web.mdb;DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}; "
'userqDSN= "data/web.mdb;DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}; "
'mallDSN= "DBQ=F:\wwwroot\data\web.mdb;DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}; "
'userqDSN= "F:\wwwroot\data\web.mdb;DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}; "
Dim Db
Db = "../data/web.mdb "
mallDSN = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
弄了半天实在是没有弄明白,烦请帮忙调试一下!
非常感谢
------解决方案--------------------注意类型。
------解决方案--------------------先输出SQL语句看看是执行哪句再查原因