Solved

I am getting "Object doesn't support this property or method: 'Eof'" on an ADODB.recordset.

Posted on 2006-07-07
6
860 Views
Last Modified: 2009-07-29
I am getting "Object doesn't support this property or method: 'Eof'" on this recordset that I have created.  I can not seem to find the error in my code to cause this.  I check the Stored procedure and it is returning more then one row.

Can anyone see what I did wrong and how to get this to work?

Thanks


<%
                    Dim cmdFreeTicketInfo
                    Dim rsFreeTicketInfo
                    set cmdFreeTicketInfo = server.CreateObject("ADODB.Command")
                        cmdFreeTicketInfo.CommandText = "selFreeTicketInfo"
                        cmdFreeTicketInfo.CommandType =adCmdStoredProc
                        cmdFreeTicketInfo.ActiveConnection = objConn
                        cmdFreeticketInfo.Parameters.append cmdFreeTicketInfo.CreateParameter("@idProduction", adInteger, adParamInput, 4, request.QueryString("idProduction"))
                    set rsFreeTicketInfo = server.CreateObject("ADODB.recordset")
                        rsFreeTicketInfo.CursorType = adUseClient
                        rsFreeTicketInfo.LockType = adLockReadOnly
                        rsFreeTicketInfo = cmdFreeTicketInfo.Execute
                       

%>
                            <table width=645 bgcolor="#ABDAEO">
                                <tr>
                                    <td colspan=2 class="smheaderboldsl">
                                    <%= rsFreeTicketInfo("fldTitle") %>, <%= rsFreeTicketInfo("fldDateTime") %>
                                       
                                    </td>                                
                                </tr>

<%
   
                        if rsFreeTicketInfo.EOF then
%>
                                <tr>
                                    <td colspan=2 class="smheaderboldsl">
                                    Sorry you have no patrons right now.
                                       
                                    </td>                                
                                </tr>
<%
                        else
                            do
%>    
                           
                            <tr>
                                <td width=545 class="reg9slbl">
                                    <%= rsFreeTicketInfo("fldName") %><br />
                                    <%= rsFreeTicketInfo("fldPhoneNumber") %>
                                </td>
                                <td width=100 class="reg9slbl">
                                    <%= rsFreeTicketInfo("fldTicketNumber") %>
                                </td>
                            </tr>
<%
                            rsFreeTicketInfo.MoveNext
                            loop until rsFreeTicketInfo.EOF
                          end if
%>


                            </table>
0
Comment
Question by:GabicusC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:tlp560
ID: 17060457
try this instead
<%
   
                        if rsFreeTicketInfo.EOF then
%>
                            <tr>
                                <td colspan=2 class="smheaderboldsl">
                                Sorry you have no patrons right now.
                                   
                                </td>                            
                            </tr>
<%
                        else
                            do until rsFreeTicketInfo.EOF
%>    
                           
                            <tr>
                                <td width=545 class="reg9slbl">
                                    <%= rsFreeTicketInfo("fldName") %><br />
                                    <%= rsFreeTicketInfo("fldPhoneNumber") %>
                                </td>
                                <td width=100 class="reg9slbl">
                                    <%= rsFreeTicketInfo("fldTicketNumber") %>
                                </td>
                            </tr>
<%
                            rsFreeTicketInfo.MoveNext
                            loop
                          end if
%>
0
 

Author Comment

by:GabicusC
ID: 17060527
Thanks tlp560 for your reply,

I am still getting the same error.  It is really odd because when I am writing the code it give me all the option for a recordset.  It is just when I run the code this error kicks in.
0
 
LVL 14

Accepted Solution

by:
CyrexCore2k earned 500 total points
ID: 17060732
The beginning bit should be

                    Dim cmdFreeTicketInfo
                    Dim rsFreeTicketInfo
                    set cmdFreeTicketInfo = server.CreateObject("ADODB.Command")
                        cmdFreeTicketInfo.CommandText = "selFreeTicketInfo"
                        cmdFreeTicketInfo.CommandType =adCmdStoredProc
                        cmdFreeTicketInfo.ActiveConnection = objConn
                        cmdFreeticketInfo.Parameters.append cmdFreeTicketInfo.CreateParameter("@idProduction", adInteger, adParamInput, 4, request.QueryString("idProduction"))
                        rsFreeTicketInfo.CursorType = adUseClient
                        rsFreeTicketInfo.LockType = adLockReadOnly
                        Set rsFreeTicketInfo = cmdFreeTicketInfo.Execute
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:tlp560
ID: 17060763
I'm using a similar app. like yours now ... the codes are similar, except on these lines, I've "set " which you don't ... something like this:

            set objCmd = server.CreateObject("ADODB.Command")
            set objCmd.ActiveConnection = objConn
            objCmd.CommandText = "sp_GetCode"
            objCmd.CommandType = adCmdStoredProc

            set objPrm = objCmd.CreateParameter("number_ID", adVarChar, adParamInput, 15,Trim(Request.Form("number_id")))
            objCmd.Parameters.Append objPrm
      
            set myRS = objCmd.Execute
0
 
LVL 1

Expert Comment

by:tlp560
ID: 17060873
that's it! look at CyrexCore2k ... that should work!

:-)
0
 

Author Comment

by:GabicusC
ID: 17061087
Thank you CyrexCore2K,

I had a feeling that it was a simple fix.  I just was not seeing it.

GabicusC
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question