SQL语句问题。

c_word 2003-05-26 06:19:16
sql="select * from user where UserPassword="& UserPassword &" and UserName='" & request.form("UserPassword") &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
Response.Redirect "1.asp"
end if
…………
感觉好象是sql这个变量有问题总是找不到所要的。
...全文
17 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
c_word 2003-05-27
  • 打赏
  • 举报
回复
改了。但好象没什么用的~
chichuli_4 2003-05-27
  • 打赏
  • 举报
回复
UserPassword字段改成字符类型吧.
c_word 2003-05-27
  • 打赏
  • 举报
回复
再顶一下。希望高手指点~
c_word 2003-05-26
  • 打赏
  • 举报
回复
顶一下~:)
c_word 2003-05-26
  • 打赏
  • 举报
回复
编译可以通过了。可是网页好象都是执行了
if rs.eof then
Response.Redirect "1.asp"
end if
这句。下面的没有执行。但是数据库里是有所写人的用户名和密码的。
chon81 2003-05-26
  • 打赏
  • 举报
回复
我想你的UserPassword字段是字符类型吧.

SQL应该这样写
select * from user where UserPassword='"& UserPassword &"' and UserName='" & request.form("UserPassword") &"'"

你少了两个单引号
Reker熊 2003-05-26
  • 打赏
  • 举报
回复
輸出sql語句,然後拿到database中執行看有沒有結果
liuyear 2003-05-26
  • 打赏
  • 举报
回复
sql="select * from user where UserPassword='"& replace(request("UserPassword"),"'","''") &"' and UserName='" & replace(request.form("Username"),"'","''") &"'"
zhuyngjie 2003-05-26
  • 打赏
  • 举报
回复
sql="select * from user where UserPassword="& UserPassword &" and UserName='" & request.form("UserPassword") &"'"
当然有问题了,看看这个行吗
sql="select * from user where UserPassword='" & request("UserPassword") & " and UserName='" & request.form("UserName") & "'"试试

c_word 2003-05-26
  • 打赏
  • 举报
回复
我还是把完整的代码写出来吧
<!--#include file="Connections/web.asp" -->
<%
UserPassword=cint (request.form("UserPassword"))
sql="select * from user where UserPassword="& UserPassword &" and UserName='" & request.form("UserPassword") &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
session("UserName")= "s"
Response.Redirect "1.asp"
end if
session("register")="TURE"
session("UserName") = rs("UserName")
session("UserEmail") = rs("UserEmail")
session("Article") = rs("Article")
session("sign") = rs("sign")
session("Sex") = rs("Sex")
session("face") = rs("face")
session("width") = rs("width")
session("height") = rs("height")
session("UserGroup") = rs("UserGroup")
session("lastlogin") = rs("lastlogin")
Response.Redirect "1.asp"
rs.close
%>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧