Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Cursor defaults to EOF


Message #1 by "Blossom" <bmathew1@s...> on Mon, 8 Apr 2002 23:59:33
Hi-

I have been trying to display data from a query in an Access database, 
but keep receiving a blank screen.  After some testing, I discovered the 
cursor is pointing to the end of the recordset.  I tried the code 
objRS2.MoveFirst to move it to the first record.  However, it did not 
work.  Are there special steps in dealing with queries/stored 
procedures?  If I run the same code below against a Table, it works fine. 
My code is as follows:

Set objRS2 = Server.CreateObject("ADODB.RecordSet")
objRS2.Open "qHtmlEmailList", objConn, adOpenDynamic, AdLockReadOnly

While not objRS2.EOF
   Response.Write objRS2("email_address")
   Response.Write "<BR>"
Wend


It seems when I run this script, the curosr is already at EOF and the 
script never executes.  I tried objRS2.MoveFirst, but receive the error 
message saying either BOF or EOF is true.

Thanks,

Blossom
Message #2 by "Charles Mabbott" <aa8vs@m...> on Mon, 08 Apr 2002 21:26:41 -0400
Blossom,
Here is a snippet from a file that I list information;
While Not objRS.EOF

           Response.Write "<TR><TD>" & objRS("Fname") & "</TD>" & _
                           "<TD>" & objRS("Lname") & "</TD>" & _
                           "<TD>" & objRS("CallID") &  "</TD>" & _
                           "<TD>" & objRS("Class") & "</TD>" & _
                           "<TD>" & objRS("Renew") &  "</TD></tr>"
           objRS.MoveNext

          Wend

Regards,
Chuck



>From: "Blossom" <bmathew1@s...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Cursor defaults to EOF
>Date: Mon, 8 Apr 2002 23:59:33
>
>Hi-
>
>I have been trying to display data from a query in an Access database,
>but keep receiving a blank screen.  After some testing, I discovered the
>cursor is pointing to the end of the recordset.  I tried the code
>objRS2.MoveFirst to move it to the first record.  However, it did not
>work.  Are there special steps in dealing with queries/stored
>procedures?  If I run the same code below against a Table, it works fine.
>My code is as follows:
>
>Set objRS2 = Server.CreateObject("ADODB.RecordSet")
>objRS2.Open "qHtmlEmailList", objConn, adOpenDynamic, AdLockReadOnly
>
>While not objRS2.EOF
>    Response.Write objRS2("email_address")
>    Response.Write "<BR>"
>Wend
>
>
>It seems when I run this script, the curosr is already at EOF and the
>script never executes.  I tried objRS2.MoveFirst, but receive the error
>message saying either BOF or EOF is true.
>
>Thanks,
>
>Blossom




"Racial interaction is described by Physics,
for every action there is an opposite
reaction.  We hate them, they hate us, and
we hate them back. And there you are, we are
trapped by mathematics."
    -Londo B5

http://aa8vs.dhs.org:81/aa8vs


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

Message #3 by "Blossom" <bmathew1@s...> on Tue, 9 Apr 2002 02:46:48
Thanks.  I just figured out the problem.  I was using the 'like' operator 
in my query.  When I tried viewing this query from an ASP page, I would 
only see a blank page and no records.  I wrote a new query without 
the 'like' operator and this time I was able to view the query from an 
ASP page and all records in the query were displayed.  Any idea why this 
is?

Thanks,

Blossom

Message #4 by "Rob Parkhouse" <rparkhouse@o...> on Tue, 9 Apr 2002 03:03:42
Just a guess but could be related to wild character:

When running queries/stored procedures via ADO you must use standard SQL. 
The standard wild character is %, not * as used in Access JET. Since your 
query used the LIKE operator perhaps you had the * in there.

If you use the % in an Access query it would not work in Access, but 
running the query from an ASP it would.

> Thanks.  I just figured out the problem.  I was using the 'like' 
operator 
i> n my query.  When I tried viewing this query from an ASP page, I would 
o> nly see a blank page and no records.  I wrote a new query without 
t> he 'like' operator and this time I was able to view the query from an 
A> SP page and all records in the query were displayed.  Any idea why this 
i> s?

> Thanks,

> Blossom


  Return to Index