当前位置:编程学习 > asp >>

asp在关键字 'user' 附近有语法错误

<% set conn=server.CreateObject("adodb.connection") str="provider=SQLOLEDB;Server=(LOCAL);Uid=sa;pwd=515891;Database=gcmpt;" conn.open str %> <% Dim rs Dim dbp user=request.Form("user") pass=request.Form("pass") set rs=Server.CreateObject("adodb.recordset") dbp=Server.Mappath("LOCAL") str="select *from user where admin='"&user&"'and pass='"&pass&"'" rs.open str,conn,1,1 if rs.eof then response.write ("<script language=""javascript"">alert(""没有该用户"");location.href(""index.asp"")</script>") response.end else response.write ("<script language=""javascript"">alert(""登录成功"");location.href(""bangong.asp"")</script>") response.end end if %> 高手请帮忙。。。。。
答案:str="select *from user where admin='"&user&"' and pass='"&pass&"'"
and前要有空格啊,不然拼装起来就是 userand pass了,当然不行。
其他:str="select *from [user] where admin='"&user&"'and pass='"&pass&"'"
以后建表的时候尽量不要用程序默认的字符。 

上一个:基于ASP工资管理系统,按时间查询工资单怎么实现
下一个:asp.net mvc 三层之间数据是怎么传递?

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,