Solved

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

Posted on 2006-07-07
6
844 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
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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