ASPVB脚本的Select问题

来源:百度知道 编辑:UC知道 时间:2024/05/18 19:48:11
我的表单中,有名称(username),密码(password)
数据库ZZ.mdb中有表zz和表user
我现在是想,在表单中,输入的名称和密码只要能个这两个表中的任意一条记录吻合,就可以进行下一步操作。
如,ZZ中名称123,密码123。USER中名称321,密码321。
不管在表单中输入123,123。还是321,321。都可以进行下一步。但是输入123,321就不行。
请问如何实现。
Set rs=db.Execute(Sql)
参数不足,期待是 2。
这个又是什么问题?
以前没修改的时候没这个问题的。。。

SELECT user.user, user.password, zz.user AS user2, zz.password AS password2
FROM [user], zz
WHERE user.user='用户名' AND user.password='密码' OR zz.[user]='用户名' AND zz.[password]='密码';

执行这条 SQL 语句,判断记录集的 EOF 属性,即可实现你所说的功能

楼上说的方法对,但是条件中OR的前面和后面要加上括号,
当然你也可以这样写
sql="select user.user,user.password form [user] where user.user='用户名' and user.password='密码'"
set rs=conn.execute (sql)
if rs.eof and rs.bof then
sql="select zz.user,zz.password form [zz] where zz.user='用户名' and zz.password='密码'"
set rs1=conn.execute (sql)
if rs1.eof and rs1.bof then
response.write "没有通过!"
else
response.write "通过!"
end if

else
response.write "通过!"

end if
rs.close
rs1.close
set rs=nothing
set rs1=nothing

建立一个recordset对象
用这种方法建set rs=server.createobject("adodb.rec