Display records!

Results 1 to 4 of 4

Thread: Display records!

  1. #1
    Still having problem Guest

    Default Display records!

    Hi,<BR><BR>I am still pondring how tro solve this problem. I have to display all the records where flag= 0 or false(It is a yes/no data type.)<BR>Here is my code:<BR><BR>&#060;Form method="post" name=form1 action="unlock_record.asp"&#062;<BR><BR>&#060;%<BR >Dim Rs, sql, Conn<BR> <BR>Set Conn=Server.CreateObject("ADODB.Connection")<BR>Co nn.Open tDSN<BR> <BR>Set Rs= Server.CreateObject("ADODB.Recordset")<BR><BR>sql= "SELECT * From tablename Where Flag=0"<BR>Response.Write sql & "<BR>"<BR><BR>Rs.Open sql, Conn, 3, 3<BR><BR>If Rs.Eof Then<BR> Response.Write "There is no record."<BR><BR> Else<BR> Do Until Rs.Eof<BR><BR>Response.Write Rs("CategoryDescription") & "<BR>"<BR>Response.Write Rs("UserName") & "<BR>"<BR>Response.Write Rs("DepartmentName")& "<BR>"<BR>Response.Write Rs("LocationName")& "<BR>" <BR>Response.Write Rs("Email")& "<BR>"<BR>Response.Write Rs("Summary")& "<BR><BR>" <BR>%&#062;<BR>&#060;A HREF="&#060;%=Rs("Content")%&#062;"&#062;See the Contents&#060;/A&#062; <BR>&#060;%<BR> Rs.MoveNext<BR> Loop<BR>End If<BR>%&#062;<BR>&#060;Input type="submit" name="hidden" value="Unlock this record"&#062;<BR>&#060;Input type= hidden name= "ID" value="&#060;%=Rs("MainID")%&#062;"&#062; <BR>&#060;/form&#062;<BR><BR>&#039;Close the recordset and connection<BR><BR>Can somebody tell me what I have done wrong here???<BR><BR>I am getting ADODB.Field (0x80020009)error<BR>Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.<BR><BR>If I take While loop then it displays the last record. <BR>With my response.Write it display like this<BR>Select * Form tablename Where Flag=0<BR>When I did a recordcount it gave me correct no of records found.<BR><BR>Then Where I am doing wrong???<BR><BR>Please somebody help me in this?? I am almost giving up.<BR>

  2. #2
    Vijay Guest

    Default RE: Display records!

    This is probably because..<BR><BR>You are looping thru&#039; the recordset in <BR>If Rs.Eof Then<BR>...<BR>...<BR>End If<BR><BR>When flow comes out of this if Statement , it&#039;s EOF.<BR><BR>Then you are doing this<BR>&#060;Input type= hidden name= "ID" value="&#060;%=Rs("MainID")%&#062;"&#062; <BR><BR>I think here you are getiing the error.<BR><BR><BR><BR><BR>

  3. #3
    Happy: Guest

    Default Thanks.

    Thanks Vijay!!!<BR>HAVE A GREAT DAY:)

  4. #4
    Join Date
    Dec 1969

    Default RE: Display records!

    Change the Do Until Rs.Eof<BR><BR>to Do While Not Rs.eof<BR><BR>because what is happening is after you move past the last record the code tries to write out empty recordset values<BR><BR>I never use Do Until Rs.Eof its a probelm causer<BR>

Posting Permissions

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