ASP连接SQL的问题,高手帮帮忙。

dark8888 2010-08-09 08:23:15
<html>
<head>
<title>用户验证</title>
</head>
<body bgcolor="#ffffff">
<%
myname=request.form("username")
mypassword=request.form("password")
set connect=server.createobject("adodb.connection")
connect.Provider="sqloledb"
connect.open "Database=xx;UID=xxs;PWD=000"
set rs=server.createobject("adodb.recordset")
rs.open "select * from xxuser where name='xx111'",connect
if rs.eof then
response.write rs("帐号错误")&"<BR>"
else
response.write rs("password")&"<BR>"
end if
rs.close


connect.close
response.write "111"&"<BR>"

set connect=Nothing
%>
===========================================================
数据库里name列有"xx111"的时候没有问题,为什么有没的时候,就出错。不能返回rs.eof。这里应该怎么写呢?
...全文
82 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
acmoc 2010-08-13
  • 打赏
  • 举报
回复
csdn论坛真操蛋。连回话的都很少
Dogfish 2010-08-10
  • 打赏
  • 举报
回复
' 因为数据集rs里没有"帐号错误"这个字段。
response.write rs("帐号错误") & "<BR>"



'更正后
response.write "帐号错误" & "<BR>"
挨踢直男 2010-08-09
  • 打赏
  • 举报
回复
rs.open "select count(*) from xxuser where name='xx111'",connect,1,1
if rs(0) = 0 then
respons.write "帐号错误"&"<br>"
else
respons.write ........
end
g497772921 2010-08-09
  • 打赏
  • 举报
回复
response.write rs("帐号错误")&"<BR>"
這個有錯誤,改成:
response.write "帐号错误<BR>"


rs.open "select * from xxuser where name='xx111'",connect 這個最好也修改一下:
rs.open "select * from xxuser where name='xx111'",connect,1,1
zkvistor 2010-08-09
  • 打赏
  • 举报
回复
rs.open "select * from xxuser where name='xx111'",connect,1,1

试试
SNOYC 2010-08-09
  • 打赏
  • 举报
回复
这样写应该没有什么问题啊,你试下
rs.open "select * from xxuser where name='xx111'",connect,1,1
dark8888 2010-08-09
  • 打赏
  • 举报
回复
不是。问题是出在这里。
rs.open "select * from xxuser where name='xx111'",connect
具体怎么弄,谁说下呢?
大家做身份验证时是怎么做的?
lzp4881 2010-08-09
  • 打赏
  • 举报
回复
response.write rs("帐号错误")&"<BR>"

改为

response.write "帐号错误<BR>"

28,409

社区成员

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

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