中国鉴宝专家最小的:我在ASP中用rst.RecordCount时的问题!!急!!

来源:百度文库 编辑:神马品牌网 时间:2024/04/23 15:32:08
我在ASP中用rst.RecordCount,得到我的数据表的行数,实在我的数据表sutdent有7行,可是得到用rst.RecordCount 得到的值却是"-1"这是为什么啊?请高手指点!谢谢!!!

----------源代码------------
<%@language=vbscript%>
<%
dim cnn,sql,rst
path="data/studentinfo.mdb"
set cnn=createobject("ADODB.connection")
set rst=createobject("adodb.recordset")
cnn.connectionString= "PROVIDER=Microsoft.jet.oledb.4.0;Data source=" & server.MapPath(path)
cnn.open
sql="select * from student"
rst.cursortype =adOpenStatic
rst.open sql,cnn
%>
<p>在ACCESS数据库studentinfo表中包含<% =rst.recordcount%>行记录</P>
<% rst.close %>
----------------------------------

------------显示结果---------------
在ACCESS数据库studentinfo表中包含-1行记录

----------------------------------

请教各位,这是为什么啊!? 谢谢了!!!

把rst.cursortype =adOpenStatic删掉,
用rst.open sql,Cnn,3,3
去试试。