INSERT INTO 语句的语法错误 web\conn.asp, line 22 20
conn.asp代码如下:<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.o...
conn.asp代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("goods.mdb")
shijian=request.form("shijian")
danhao=request.form("danhao")
pinming=request.form("pinming")
shuliang=request.form("shuliang")
qinkuang=request.form("qinkuang")
didian=request.form("didian")
guanli=request.form("guanli")
beizhu=request.form("beizhu")
exec="insert into guestbook(shijian,danhao,pinming,shuliang,qinkuan,didian,guanli,beizhu)values('"+shijian+"',"+danhao+",'"+pinming+"','"+shuliang+"','"+qinkuan+"','"+didian+"','"+guanli+"','"+beizhu+"')"
conn.execute exec
conn.close
set conn=nothing
response.write "记录添加成功!"
%>
</body>
</html>
数据库的内容是:
ID shijian danhao pinming shuliang qinkuang didian guanli beizhu
高手帮忙看看是哪里出错了啊?
谢谢两位的建议
还有有其他的可能呢?
期待大家的回复 展开
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("goods.mdb")
shijian=request.form("shijian")
danhao=request.form("danhao")
pinming=request.form("pinming")
shuliang=request.form("shuliang")
qinkuang=request.form("qinkuang")
didian=request.form("didian")
guanli=request.form("guanli")
beizhu=request.form("beizhu")
exec="insert into guestbook(shijian,danhao,pinming,shuliang,qinkuan,didian,guanli,beizhu)values('"+shijian+"',"+danhao+",'"+pinming+"','"+shuliang+"','"+qinkuan+"','"+didian+"','"+guanli+"','"+beizhu+"')"
conn.execute exec
conn.close
set conn=nothing
response.write "记录添加成功!"
%>
</body>
</html>
数据库的内容是:
ID shijian danhao pinming shuliang qinkuang didian guanli beizhu
高手帮忙看看是哪里出错了啊?
谢谢两位的建议
还有有其他的可能呢?
期待大家的回复 展开
展开全部
在access里边时间日期型要用#而不是单引号
exec="insert into guestbook(shijian,danhao,pinming,shuliang,qinkuan,didian,guanli,beizhu)values(#"+shijian+"#,"+danhao+",'"+pinming+"','"+shuliang+"','"+qinkuan+"','"+didian+"','"+guanli+"','"+beizhu+"')"
exec="insert into guestbook(shijian,danhao,pinming,shuliang,qinkuan,didian,guanli,beizhu)values(#"+shijian+"#,"+danhao+",'"+pinming+"','"+shuliang+"','"+qinkuan+"','"+didian+"','"+guanli+"','"+beizhu+"')"
参考资料: 经验
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询