Microsoft JET Database Engine 错误 '80040e14' FROM 子句语法错误。
connection.asp
<%
<HTML>
<HEAD>
</HEAD>
<BODY>
<!-- 请在这里输入您的HTML代码 -->
<%
dim connstr
connstr ="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("db1.mdb")
dim conn
set conn=Server.CreateObject("adodb.connection")
conn.Open connstr
%>
</BODY>
</HTML>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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>
<!--#include file="connection.asp"-->
<%
strBookID = request.QueryString("BookID")
'response.Write(strBookID) 可以得到strBookID的值
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "delete from books"
strSQL = strSQL&"where BookID="&Trim(strBookID)
rs.open strSQL ,conn, 1,3
rs.delete
rs.update
rs.close
conn.close
response.Redirect("index.asp")
%>
<body>
</body>
</html>
[解决办法]
strSQL = "delete from books"
strSQL = strSQL & " where BookID=" & Trim(strBookID)
[解决办法]
1,where前加个空格
2,如果BookID为字符型,则:
strSQL = "delete from books "
strSQL = strSQL & " where BookID='" & Trim(strBookID) & "'"