建站代码网

热门标签

限制从查询返回的记录

当你在建立很有可能会返回很多记录的应用时,或者花很长时间来返回一些在改善期间你可能想添加的下面的代码。

Set rs = Server.CreateObject("ADODB.Recordset") rs.maxrecords=15

This will return 15 records (less if there were not 15 matches made). By limiting the data returned from a query you do run the risk of not knowing how resposive your application may or may not be, so it's best used in the early stages of application development <% accessdb="simpsons" cn="DRIVER={Microsoft Access Driver (*.mdb)};" cn=cn & "DBQ=" & server.mappath(accessdb) Set rs = Server.CreateObject("ADODB.Recordset") rs.maxrecords=15 sql = "select blackboard from simpsons" rs.Open sql, cn %> <% On Error Resume Next rs.MoveFirst do while Not rs.eof %> <font face="arial" size="2"> <%= rs("blackboard") %> </font> <br> <% rs.MoveNext loop%>

热门信息

X