永发信息网

asp里出现You have an error in your SQL syntax

答案:1  悬赏:80  手机版
解决时间 2021-04-13 15:05
  • 提问者网友:欲劫无渡
  • 2021-04-13 10:34

想把数据插入到一个mysql表中出现..高手快来看看吧

Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Index,Type,ItemID,ItemVer,Money,ChrID,time) values ('6429',1,'135447738,431,0,0,' at line 1

/admin/auSave.asp,行 20

下面是整个代码,,,

<% if Session("test_status") <> "login" then response.redirect "login.asp" %>
<!--#include file="config.asp" -->
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"

strconnection="driver={mysql odbc 3.51 driver};database="&FsoName&";server="&ServerName&";uid="&dataLogName&";password="&dataPwd&""
set adodataconn = server.createobject("adodb.connection")
adodataconn.open strconnection

index= request("id")+3000
itemid=Request.Form("items")
money=Request.Form("Gold")
ChrID= request("id")

strsql="insert into t_auction_result(Index,Type,ItemID,ItemVer,Money,ChrID,time) values ('"&Index&"',1,'"&ItemID&"',11,'"&Money&"','"&ChrID&"',3600)"
adodataconn.execute(strsql)

rs.close
response.Write"<script language='javascript'>alert('ok!');history.back();</script>"
response.End
%>


最佳答案
  • 五星知识达人网友:青尢
  • 2021-04-13 11:32

strsql="insert into t_auction_result(Index,Type,ItemID,ItemVer,Money,ChrID,time) values ('"&Index&"',1,'"&ItemID&"',11,'"&Money&"','"&ChrID&"',3600)"
你使用了SQL保留字做字段名


如index type time,这三个改一下就好了.


如改成sindex stype stime

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯