怎样解决INSERT INTO 语句的语法错误
145user_id=Request.Form("user_id")146user_name=Request.Form("user_name")147sex=Reques...
145 user_id=Request.Form("user_id")
146 user_name=Request.Form("user_name")
147 sex=Request.Form("sex")
148 user_old=request.Form("user_old")
149 user_status=Request.Form("user_status")
150 user_post=Request.Form("user_post")
151 dept=Request.Form("dept")
152 tel=request.Form("tel")
153 sql="select count(*) from readerinfo where userid="&user_id&""
154 set rs=conn.execute(sql)
155 if rs(0)=0 then
156 sql1="insert into readerinfo(userid,name,sex,age,identity,post,dept,tel)"
157 sql1=sql1&" values ("&user_id&",'"&user_name&"','"&sex&"',"&user_old&",'"&user_status&"','"&user_post&"','"&dept&"','"&tel&"')"
158 conn.execute(sql1)
159 sql2="insert into login(userid,[password],title) values("&user_id&",'"&user_id&"','"&user_status&"')"
160 conn.execute(sql2)
161 Response.Redirect "borroweradd.asp?comm=信息添加成功!"
浏览器显示问题:
错误类型:
Microsoft JET Database Engine (0x80040E14)
INSERT INTO 语句的语法错误。
/tsgl/borroweradd.asp, 第 158 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; KuGooSoft)
网页:
POST 153 ??? /tsgl/borroweradd.asp
几个字段中除了 userid和age为数字,其他为文本
我看不出来哪里有错误,请高手指教! 展开
146 user_name=Request.Form("user_name")
147 sex=Request.Form("sex")
148 user_old=request.Form("user_old")
149 user_status=Request.Form("user_status")
150 user_post=Request.Form("user_post")
151 dept=Request.Form("dept")
152 tel=request.Form("tel")
153 sql="select count(*) from readerinfo where userid="&user_id&""
154 set rs=conn.execute(sql)
155 if rs(0)=0 then
156 sql1="insert into readerinfo(userid,name,sex,age,identity,post,dept,tel)"
157 sql1=sql1&" values ("&user_id&",'"&user_name&"','"&sex&"',"&user_old&",'"&user_status&"','"&user_post&"','"&dept&"','"&tel&"')"
158 conn.execute(sql1)
159 sql2="insert into login(userid,[password],title) values("&user_id&",'"&user_id&"','"&user_status&"')"
160 conn.execute(sql2)
161 Response.Redirect "borroweradd.asp?comm=信息添加成功!"
浏览器显示问题:
错误类型:
Microsoft JET Database Engine (0x80040E14)
INSERT INTO 语句的语法错误。
/tsgl/borroweradd.asp, 第 158 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; KuGooSoft)
网页:
POST 153 ??? /tsgl/borroweradd.asp
几个字段中除了 userid和age为数字,其他为文本
我看不出来哪里有错误,请高手指教! 展开
展开全部
"insert into readerinfo(userid,name,sex,age,identity,post,dept,tel)"
sql 语句错了
应该是
"insert into readerinfo(" & userid & "," & name & "," & sex & "," & age & "," & identity & "," & post & "," & dept & "," & tel & ")"
还有你其他的代码中每个“&”字符要和左右有个空格
sql 语句错了
应该是
"insert into readerinfo(" & userid & "," & name & "," & sex & "," & age & "," & identity & "," & post & "," & dept & "," & tel & ")"
还有你其他的代码中每个“&”字符要和左右有个空格
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询