Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2004, 02:45 AM
Authorized User
 
Join Date: Jan 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADODB.Recordset error '800a0cc1'Item cannot be....

 I have the following code for a combo. When i try to populate it from a table[structure is : GateDetails(GD_GateCode,GD_GateDesc,GD_Deleted) ], i get this error: "ADODB.Recordset error '800a0cc1'Item cannot be found in the collection correspondin to the requested name or ordinal"

td><select id=cboGate name=cboGate>
        <%
            'Fetch Gate Names
            set rsTemp = CreateObject("ADODB.Recordset")
            rsTemp.open "Select GD_GateCode from GateDetails where GD_Deleted=0",Conn

            'Load Gate Combo%>
            <%rsTemp.MoveFirst%>
            <%do while rsTemp.EOF=false%>
<option value =<%=rsTemp.Fields("GD_GateCode").Value %>><%'=rsTemp.Fields("GD_GateDesc").Value

%></option>
                <%rsTemp.MoveNext%>
            <%loop%>
            </select>
        </td>

Please help!
Thanks
Ashu
 
Old March 5th, 2004, 03:50 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You didn't include the Description field in your SELECT statement. Even if the table contains the column, when you don't select it, you can't use it:
Code:
rsTemp.open "SELECT GD_GateCode, GD_GateDesc FROM GateDetails WHERE GD_Deleted=0", Conn 
...           
<option value =<%=rsTemp.Fields("GD_GateCode").Value %>><%'=rsTemp.Fields("GD_GateDesc").Value 
%></option>        
...
There is no need to use <% and %> so much. You can wrap them all in one server side code block:<%
'Fetch Gate Names
Set rsTemp = CreateObject("ADODB.Recordset")
rsTemp.open "SELECT GD_GateCode, GD_GateDesc FROM GateDetails WHERE GD_Deleted=0", Conn

'Load Gate Combo
rsTemp.MoveFirst
Do While rsTemp.EOF = False
  Response.Write("<option value =""" & rsTemp.Fields("GD_GateCode").Value & """>"
  Response.Write(rsTemp.Fields("GD_GateDesc").Value & "</option>")
  rsTemp.MoveNext
loop

This should speed up your page just a little, as the processing engine doesn't have to switch code blocks.

HtH,

Imar




---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Recordset error 800a0e78 quinnie Classic ASP Databases 6 October 2nd, 2007 05:13 PM
ADODB.Recordset error lance Wrox Book Feedback 2 February 23rd, 2007 02:37 PM
ADODB.RecordSet -- Error nabeeljohn Classic ASP Professional 10 November 9th, 2006 05:23 AM
ADODB.Recordset error '800a0cb3' khalid08 Classic ASP Databases 1 September 23rd, 2003 07:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.