?
Solved

ADODB.Recordset error '800a0cc1'

Posted on 2003-03-28
11
Medium Priority
?
3,096 Views
Last Modified: 2007-12-19
Can Somebody Tell me why i'm getting this error:

ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.


This is the Function where the error occured, and I'm only returning one column(rsF("RetCount")) from this query, just a sum of a field. What's wrong with my code? Please i really need some help fast :)


Function GetCount(sConField, sTempDateStr, bPageCount, conn)
Dim sSql, rs
     Set rsF = Server.CreateObject("ADODB.Recordset")
     If bPageCount Then
          sSql = "SELECT SUM(WOMaster.ExpectedPageCount) AS [RetCount] " & _
                  "FROM AccountMaster " & _
                  "LEFT JOIN JobMaster ON AccountMaster.CustNumber = JobMaster.CustNumber  " & _
                  "LEFT JOIN WOMaster ON JobMaster.JobNumber = WOMaster.JobNumber  " & _
                  "LEFT JOIN WOTracking ON WOMaster.WONumber = WOTracking.WONumber  " & _
                  "WHERE AccountMaster.CustNumber = '10-MOORE01' AND DATEDIFF(DAY, " & sConField & ", '" & sTempDateStr & "') = 0  " & _
                  "AND WOMaster.Status <>'4'  " & _
                  "AND WOMaster.WOType <> 600 "     
     Else
          sSql = "SELECT SUM(WOMaster.ExpectedMailCount) AS [RetCount] " & _
                  "FROM AccountMaster " & _
                  "LEFT JOIN JobMaster ON AccountMaster.CustNumber = JobMaster.CustNumber  " & _
                  "LEFT JOIN WOMaster ON JobMaster.JobNumber = WOMaster.JobNumber  " & _
                  "LEFT JOIN WOTracking ON WOMaster.WONumber = WOTracking.WONumber  " & _
                  "WHERE AccountMaster.CustNumber = '10-MOORE01' AND DATEDIFF(DAY, " & sConField & ", '" & sTempDateStr & "') = 0  " & _
                  "AND WOMaster.Status <>'4'  " & _
                  "AND WOMaster.WOType <> 600 "
     End If
     rsF.Open sql, conn, 3, 3
     If Not rsF.EOF Then
          rsf.MoveFirst
          if IsNull(rsF("RetCount")) = false or rsF("RetCount") <> "" then
               GetCount = clng(rsF("RecCount"))
          else
               GetCount = 0
          end if
         
     Else
          GetCount = 0
     End If
     rsF.Close
     set rsF = nothing
End Function
0
Comment
Question by:SidneyF
[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
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 8227933
Hello SidneyF,

what about the second field RecCount?
GetCount = clng(rsF("RecCount"))

HAGD:O)Bruintje
0
 

Author Comment

by:SidneyF
ID: 8227974
ummm.. What second Field? my query will only return 1 field right? just the RetCount. Is there something in my code that i did not see :)
0
 
LVL 3

Expert Comment

by:keystrokes
ID: 8227980
do a response.write rsF(0).name to see what the name of the field is.
0
Independent Software Vendors: 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 44

Expert Comment

by:bruintje
ID: 8227981
yes indeed but you're asking for RecCount instead of RetCount

if IsNull(rsF("RetCount")) = false or rsF("RetCount") <> "" then
   GetCount = clng(rsF("RecCount")) <----RecCount
else
   GetCount = 0
end if
0
 

Author Comment

by:SidneyF
ID: 8228033
Sorry about that it was a typo error. but in my realy code its RetCount... not RecCount
0
 
LVL 7

Expert Comment

by:markhoy
ID: 8228041
do a response.write sSQL
response.end

run the output as a query against your DB to check field types and field names match.

iS rsF("RecCount")) a number?
0
 

Author Comment

by:SidneyF
ID: 8228096
Here's the weirdest thing, when i response.write rsF(0).name do you know what did it show? its shows:

tempDate

I mean how on earth did it became tempDate when i explicitly give an alias to it [RecCount] hummm.... i'm kinda lost in this thing :)
0
 
LVL 7

Expert Comment

by:markhoy
ID: 8228127
which is why I made my suggestion, so that you can see the order and names the fields are returned (and why ordinal references to a recordset object is not a good idea ;-) ) from your query: it does what you tell it, not what you want it to do!
0
 
LVL 3

Accepted Solution

by:
keystrokes earned 150 total points
ID: 8228145
That's because in your open recordset line, you use "sql", not "sSql" !
 (sSql="...")
then right after this you do
(rsF.Open sql, conn, 3, 3)
So sql must be previously define and querying a tempDate.
0
 

Author Comment

by:SidneyF
ID: 8228213
Oh my god! what have i done :) Keystrokes you have a very good eye sight :)

May its because i've been working overnight and i felt very sleepy already but i need to finish this that's i did not see that my varaible is typed incorrectly.

What bothers me right now is that i used Option Explicit in all codes but how come it did not give me an error about the difference of "sql" and "sSql" hummm... its weird.

Anyways thanks a lot guys ;)
0
 
LVL 3

Expert Comment

by:keystrokes
ID: 8228257
The option explicit did not detect an error because there is a variable sql somewhere on the page or an included page.  do a response.write sql, you will be amazed what you will see ;)

Well, get some sleep.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 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