Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2003
    Posts
    114

    Unanswered: Avoiding EOF Error

    I am querying a sql server db from asp/ado. I am trying to get data from a list of people but all of them may not have the data I am looking for. As a result, when the query gets to that person/record, I get the message:

    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    How can I avoid this message? Here is my code:

    sql="SELECT TrngDate, Effort, UnitMeas FROM TrainingData WHERE PartID = " & CLng(iPartID)

    Set rs=Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 1, 2

    Do While Not rs.eof
    .
    .
    .
    rs.MoveNext
    Loop

    I also used the conn.Execute approach.


    This a recurring issue for me. Any ideas?

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Check this KBA and get the fix if required.

    Also check whether that would be a closed recordset while error was returned. And also check whether second RS is opened/returned.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Apr 2003
    Posts
    114

    Thanks!

    Originally posted by Satya
    Check this KBA and get the fix if required.

    Also check whether that would be a closed recordset while error was returned. And also check whether second RS is opened/returned.
    But it doesn't appear that the problem referred to is my issue. My issue is that the record that I am looking for may in fact not exist. I am not sure how to determine that before 'looking' for it. Is there any way I can get a record count? In the past I have tried this and it returns a recordcount of -1.

  4. #4
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    In that case while opening of RS just count from the table and use the variable to avoid it.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  5. #5
    Join Date
    Apr 2003
    Posts
    114

    I'm sorry to bother you ...

    Originally posted by Satya
    In that case while opening of RS just count from the table and use the variable to avoid it.
    but I don't understand how that would look syntactically. Could you show me the code?

    Thanks!

  6. #6
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Dont' be sorry..

    Rather I fee so, (Im no developer )
    Still check this webpage for code example.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

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