CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal.
- Article ID:
29 - Date Created
Thursday, October 7, 2010 - Last Updated
Thursday, January 19, 2023 - This Article Has been Viewed
2916 times - Short Desc
Misspelled SQL Columns names in your recordset will cause an error; ensure all columns are spelled correctly and are present in your SQL Statement before calling them to be used in your RecordSet. - Details
When creating a recordset to go with your SQL Statement, sometimes you might misspell a fieldname, this happens more often then one might imagine, especially with larger data sets.ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
page.asp, line 37 - Recreate Issue
Let's look at the following SQL Statement
Scenario #1<%
sql.commandtext="select column1, column2 from table1 where column1='something'"
set rs = sql.execute
%>
The above is our SQL Statement and our RecordSet.<%
=rs("column3")
%>
The recordset we just created above will appear to be accurate, except that column3 does not exist in our SQL Statement and, therefore, will make the 800A0CC1 error.
Scenario #2<%
Set sql = CreateObject("ADODB.Command")
sql.ActiveConnection=siteconn
sql.Prepared = true
sql.commandtext="select column1, column2 from table1 where column1='something'"
set rs = sqlone.execute
%>
In this code, we notice the sqlone does not match the sql.commandtext - Resolve Issue
Scenario #1
We will need to make sure that all columns are added to our SQL Statement before writing our recordsets for them.<%
sql.commandtext="select column1, column2, column3 from table1 where column1='something'"
set rs = sql.execute
%>
The above is our SQL Statement and our RecordSet.<%
=rs("column3")
%>
The above will run now without an issue, as we have column3 in our SQL Statement and have it spelled out correctly for our recordset to display its content.
Scenario #2<%
Set sql = CreateObject("ADODB.Command")
sql.ActiveConnection=siteconn
sql.Prepared = true
sql.commandtext="select column1, column2 from table1 where column1='something'"
set rs = sql.execute
%>
Make sure the sql.execute matches the sql.commandtext.
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19544
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16826