日期:2014-05-17  浏览次数:21022 次

查询到两条记录,为什么rs.recordcount的值为-1?
语句如下:
Set   rs=conn.execute( "select   *   from   studentinfo   where   idcard= ' "&idcard& " ' ")
if   rs.eof   and   rs.bof   then
      errormsg= "3 "
      response.Redirect   "client_stuinfofind.asp?errormsg= "&errormsg
      Set   rs=nothing
end   if
total=rs.recordcount
执行后查询到两条记录,想看看总共多少条记录,使用rs.recordcount,但是rs.recordcount的为-1

------解决方案--------------------
conn.execute 是没有游标的,要用adOpenKeyset游标
set rs = server.createobject( "adodb.recordset ")
rs.open "select *** ", conn, adOpenKeyset, adLockReadOnly

------解决方案--------------------
rs.open "select *** ", conn1,3