关于asp+access操作语法错误,代码如下,调试出现 INSERT INTO 语句的语法错误。 60
<%id=request.QueryString("id")price=request.QueryString("price")nn=request.QueryStrin...
<%
id=request.QueryString("id")
price=request.QueryString("price")
nn=request.QueryString("number")
total=price*nn
set cn=server.CreateObject("ADODB.Connection")
cn.connectionString="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("dh.mdb")
cn.open
sql="INSERT INTO ddb(username,comid,nn,total,dt,isprocessed) values ('"&session("username")&"','"&id&"',"&nn&",'"&date&"',"&total&",'0')"
cn.execute(sql)
sql="update spb set count=spb.count-"&nn&" where id='"&id&"'"
set rs1=cn.execute(sql)
%>
<!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=utf-8" />
<title>订单生成</title>
</head>
<body>
<p>您的订货信息已经被登记,如有需要查阅订单表</p>
<p>请从上部继续选择</p>
</body>
</html>
请高手帮忙解决下这种错误,谢谢 展开
id=request.QueryString("id")
price=request.QueryString("price")
nn=request.QueryString("number")
total=price*nn
set cn=server.CreateObject("ADODB.Connection")
cn.connectionString="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("dh.mdb")
cn.open
sql="INSERT INTO ddb(username,comid,nn,total,dt,isprocessed) values ('"&session("username")&"','"&id&"',"&nn&",'"&date&"',"&total&",'0')"
cn.execute(sql)
sql="update spb set count=spb.count-"&nn&" where id='"&id&"'"
set rs1=cn.execute(sql)
%>
<!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=utf-8" />
<title>订单生成</title>
</head>
<body>
<p>您的订货信息已经被登记,如有需要查阅订单表</p>
<p>请从上部继续选择</p>
</body>
</html>
请高手帮忙解决下这种错误,谢谢 展开
2个回答
展开全部
请检查你的数据库表的字段属性,比如我觉得comid应该为数值型,还有就是access数据库,时间前是用#函数#符号的,则可改为下面的:
sql="INSERT INTO ddb(username,comid,nn,total,dt,isprocessed) values ('"&session("username")&"',"&id&","&nn&",#"&date()&"#,"&total&",'0')"
sql="INSERT INTO ddb(username,comid,nn,total,dt,isprocessed) values ('"&session("username")&"',"&id&","&nn&",#"&date()&"#,"&total&",'0')"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询