MaxRecords not working.

Results 1 to 2 of 2

Thread: MaxRecords not working.

  1. #1
    Join Date
    Dec 1969

    Default MaxRecords not working.

    Hey all,<BR>I am having a problem with one of my pages.<BR><BR>Here is my code:<BR><BR>&#060;%<BR>Set objConn = Server.CreateObject ("ADODB.Connection")<BR>objConn.Open "news", "user", "password"<BR>Set objRec = Server.CreateObject ("ADODB.Recordset")<BR>objRec.MaxRecords = 5<BR>objRec.Open "News", objConn, 2,1,2<BR>%&#062;<BR><BR>&#060;%<BR>objRec.MoveLast <BR>While NOT objRec.EOF<BR>Response.Write "&#060;a href=http://mysitepage.asp?ID=" & objRec("Key") & "&#062;" & objRec("Title") & "&#060;/a&#062;"<BR>objRec.MovePrevious<BR>Wend<BR>Set ObjRec = Nothing<BR>objConn.Close<BR>Set objConn = Nothing<BR>%&#062; <BR><BR>As you can see, I am trying to limit the number of records returned to the 5 most recent, but when I run the script, <BR>it returns every record in the database.<BR>What am I doing wrong? I can&#039;t seem to find anything in the FAQ&#039;s or the commonly asked questions that looks any different from my code.<BR><BR>Thanks in advance for any help,<BR>Xander<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: MaxRecords not working.

    Why don&#039;t use "SELECT TOP 5 FROM Table ORDER BY..."?<BR><BR>Carlos

Posting Permissions

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