limiting recordset

Results 1 to 5 of 5

Thread: limiting recordset

  1. #1
    coopetj Guest

    Default limiting recordset

    I know you can use the recordcount property to limit the number of returned recordes but how and where would you use it?<BR><BR>After you create the RS or before?

  2. #2
    Join Date
    Dec 1969

    Default RE: limiting recordset

    What you are looking for is the maxrecords property. Set it before you execute the query.

  3. #3
    fred Guest

    Default RE: limiting recordset

    If you are using Access or MS SQL 7.0 you can use the TOP funciton in your SQL-statement to speed it up. See example below.<BR>Just specify the number you need...<BR><BR>rs.Open "SELECT TOP 5 prodID FROM Products",db<BR><BR>Happy programming!

  4. #4
    Coopetj Guest

    Default RE: limiting recordset

    Thanks guys.<BR><BR>Im not using SQL but that is good to know. Eventually my cheapskate management will bring up some SQL servers.<BR><BR>I hope they dont frequent this

  5. #5
    cooetj Guest

    Default ISNT WORKING>>

    This is my code:<BR><BR>&#060;%<BR>Option Explicit<BR><BR>dim conn, DSNtemp, RS, StrQ, dtPost, Caption, Recipient, Content, Author<BR><BR>&#039;Connect to DB<BR>set conn = server.createobject("adodb.connection")<BR>DSNtemp ="DRIVER={Microsoft Access Driver (*.mdb)}; "<BR>DSNtemp=dsntemp & "DBQ=" & server.mappath("/dbWeb/dbNews.mdb")<BR>conn.Open DSNtemp<BR><BR>&#039;Create Recordset Obj<BR>set RS = Server.CreateObject("ADODB.Recordset")<BR><BR>&#03 9;Set the maximum number of records to 1 to return the most recent post<BR>RS.maxrecords = 1<BR><BR>&#039;Build SQL String<BR>strQ = "select * from tblNews where recipient = &#039;allstaff&#039; order by dtPost Desc"<BR><BR><BR>&#039;Open recordset and run assigned SQL Query<BR>Set Rs = conn.Execute(strQ)<BR><BR><BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts