日期:2014-05-17  浏览次数:20792 次

在asp文件中添加命令的服务器行为,类型为删除
浏览器总是提示
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'id=' 中。
/source/del.asp, 第 16 行

请高手指点原因啊。
代码如下:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conbooks.asp" -->
<%

if(Request("id") <> "") then deldata__strid = Request("id")

%>
<%

set deldata = Server.CreateObject("ADODB.Command")
deldata.ActiveConnection = MM_conbooks_STRING
deldata.CommandText = "DELETE FROM liuyandata WHERE id=" + Replace(deldata__strid, "'", "''") + " "
deldata.CommandType = 1
deldata.CommandTimeout = 0
deldata.Prepared = true
deldata.Execute() //这句是第16行

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
</body>
</html>

------解决方案--------------------
id没有传过来。
 Replace(deldata__strid, "'", "''") 
也是有问题的
==》 Replace(deldata__strid, "'", "")
------解决方案--------------------
ID是空的,
 还有,把+号换成&,,,用&连接