关于asp的游标问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:55:13
set rs=server.CreateObject("adodb.recordset")
sql="select * from member where name='"&name&"'and pw='"&pw&"'"
rs.open sql,conn,1,1
if not rs.eof then
session("name")=rs("name")
session("id")=rs("id")
以上是一个核对用户名和密码的代码,如果说1,1意思分别是
只读,可自由移动;只读,不能修改
那么在select查询完后,
如果为空则游标为rs.bof and rs.eof;
如果不为空是不是指当前游标选中着查询出来的这一行显示的用户名和密码,所以是not rs.eof且not rs.bof 是不是这个意思啊.
如果我的意思正确的话,上述代码的if not rs.eof then是不是也能换成if not rs.bof then啊
我的这个页面改成if not rs.bof then了,没有出错啊,真的是越来越糊涂了,等我再研究两天,如果你说的对,分就给你

"上述代码的if not rs.eof then是不是也能换成if not rs.bof then啊"

不可以!!!
not rs.eof是没有到记录集的尾,not rs.bof是没有到记录集的头,查询是从记录集的头开始的,直到尾,如果换成not rs.bof,查询会出错的。

打个比方:你从某街道的1号门牌查找,往后是2、3、4....
你没有按照街道的最大号做参照,而拿1号做参照,那么你能够查结束吗?(不太恰当的比方,但可以说明问题)

是的,就是这个意思