运行写入ACCESS数据库并提交写入信息时,出现INSERT INTO 语句的语法错误,不能把数据写入数据库?
<%setconn=server.createobject("adodb.connection")DBPath=Server.MapPath("data/feedback...
<%
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("data/feedback.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
tmpmess=Server.HtmlEncode(request.form("comment"))
tmpmess=replace(tmpmess,chr(10)," <br>")
set rstmp=server.createobject("adodb.recordset")
set rstmp=conn.execute("Select * from feedbackinfo Where comment='"&trim(tmpmess)&"'")
if not rstmp.eof then
response.write("<p><font color=red style=""font:11pt"">错误:您重复提交了相同的反馈信息!</font><p><a href=javascript:history.back()>按此返回>></a>")
else
str="Insert Into feedbackinfo (name,money,tradecdf,gamexy,plait,salename,saleqq,buyname,gameser,mph,email,Color,Knowus,Way,bank,mess_date,mess_time,comment) values('"
str=str & request.form("name") & "','"
str=str & request.form("money") & "','"
str=str & request.form("tradecdf") & "','"
str=str & request.form("gamexy") & "','"
str=str & request.form("plait") & "','"
str=str & request.form("salename") & "','"
str=str & request.form("saleqq") & "','"
str=str & request.form("buyname") & "','"
str=str & request.form("gameser") & "','"
str=str & request.form("mph") & "','"
str=str & request.form("email") & "','"
str=str & request.form("Color") & "','"
str=str & request.form("Knowus") & "','"
str=str & request.form("Way") & "','"
str=str & request.form("bank") & "','"
str=str & cstr(DATE) & "','"
str=str & cstr(Time) & "','"
str=str & tmpmess &"',)"
' Response.Write str
conn.execute(str)
set rs=server.createobject("adodb.recordset")
set rs=conn.execute("Select * from feedbackinfo Where comment='"&tmpmess&"'")
session.contents("comment")=tmpmess
%>
已经查到问题的所在了,是下面的Insert Into 字段太长,超过128字节,应该怎样修改才合理?
str="Insert Into feedbackinfo (name,money,tradecdf,gamexy,plait,salename,saleqq,buyname,gameser,mph,email,Color,Knowus,Way,bank,mess_date,mess_time,comment) values('"
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。
/koocn/FEEDBACK.ASP, 第 36 行 展开
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("data/feedback.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
tmpmess=Server.HtmlEncode(request.form("comment"))
tmpmess=replace(tmpmess,chr(10)," <br>")
set rstmp=server.createobject("adodb.recordset")
set rstmp=conn.execute("Select * from feedbackinfo Where comment='"&trim(tmpmess)&"'")
if not rstmp.eof then
response.write("<p><font color=red style=""font:11pt"">错误:您重复提交了相同的反馈信息!</font><p><a href=javascript:history.back()>按此返回>></a>")
else
str="Insert Into feedbackinfo (name,money,tradecdf,gamexy,plait,salename,saleqq,buyname,gameser,mph,email,Color,Knowus,Way,bank,mess_date,mess_time,comment) values('"
str=str & request.form("name") & "','"
str=str & request.form("money") & "','"
str=str & request.form("tradecdf") & "','"
str=str & request.form("gamexy") & "','"
str=str & request.form("plait") & "','"
str=str & request.form("salename") & "','"
str=str & request.form("saleqq") & "','"
str=str & request.form("buyname") & "','"
str=str & request.form("gameser") & "','"
str=str & request.form("mph") & "','"
str=str & request.form("email") & "','"
str=str & request.form("Color") & "','"
str=str & request.form("Knowus") & "','"
str=str & request.form("Way") & "','"
str=str & request.form("bank") & "','"
str=str & cstr(DATE) & "','"
str=str & cstr(Time) & "','"
str=str & tmpmess &"',)"
' Response.Write str
conn.execute(str)
set rs=server.createobject("adodb.recordset")
set rs=conn.execute("Select * from feedbackinfo Where comment='"&tmpmess&"'")
session.contents("comment")=tmpmess
%>
已经查到问题的所在了,是下面的Insert Into 字段太长,超过128字节,应该怎样修改才合理?
str="Insert Into feedbackinfo (name,money,tradecdf,gamexy,plait,salename,saleqq,buyname,gameser,mph,email,Color,Knowus,Way,bank,mess_date,mess_time,comment) values('"
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。
/koocn/FEEDBACK.ASP, 第 36 行 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询