Set RowCount的问题,请高手指教啊,急
天野青鸟 2007-10-18 10:51:05 <%
DSN = Application("fulj_dsn")
Set Conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")
Conn.Open DSN
'sql=" Set RowCount 10 select ItemCode,Category,ItemName from ItemInfo order by NewDate desc"
sql="select ItemCode,Category,ItemName from ItemInfo order by NewDate desc"
rs.open sql,conn,1,1
%>
<%
i=1
while not rs.eof
%>
<li><%=i%>. <a href="../itemdetail/staticHtml/<%=rs("Category")%>/<%=rs("ItemCode")%>.htm"><%=rs("ItemName")%></a></li>
<%
rs.movenext
i=i+1
wend
rs.close
%>
</ul>
</div>
<%
conn.close
set rs=nothing
set conn=nothing
%>
数据库sybase比较老,不能用top N 方式取前几条数据,所以就用Set RowCount 10 的方式
可是加上Set RowCount 10 之后就报错。
ADODB.Recordset 错误 '800a0e78'
对象关闭时,不允许操作。
明明打开的,就是报错。
报错的是 while not rs.eof 这一行
把Set RowCount 10去掉后又正常了
请教下高手这么搞啊?不是用Set RowCount 10取前10条记录的么?