Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Query Error
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  15:33:35  Show Profile

Do you guys see any Issue with the below Query :

SELECT Count(*) as RCount FROM SubCategory

I am getting Error in ASP page :

Item cannot be found in the collection corresponding to the requested name or ordinal.

Jezmeister
Senior Member

United Kingdom
1141 Posts

Posted - 10 May 2007 :  15:49:26  Show Profile  Visit Jezmeister's Homepage
I presume SubCategory actually exists in the database not spelt wrong? that'd be the most common cause of that that i've come across.
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 10 May 2007 :  16:01:01  Show Profile  Visit AnonJr's Homepage
Depending on the DB Engine you are using (and how its set up) the table name could be case-sensitive too.
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  16:03:46  Show Profile

1) SubCategory DOES exist

2) DB Engine is Access and using ADO
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 10 May 2007 :  16:14:22  Show Profile  Send ruirib a Yahoo! Message
The error message results not from the query, but from the access to the record.

You should try to get rs("RCount") (rs should be replaced by the actual name of the recordset variable you are using) and you surely are not doing that.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  16:28:18  Show Profile

sql = "SELECT Count(*) as RCount FROM SubCategory "

If RS.State=1 then
RS.Close
End IF
RS.Open sql, session("cn"),3,3
ListingCount24h=RS("RCount")
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 10 May 2007 :  16:43:30  Show Profile  Send ruirib a Yahoo! Message
Well try it like this:

ListingCount24h=RS(0)



Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  16:56:13  Show Profile
sql = "SELECT Count(*) as RCount FROM SubCategory "
If RS.State=1 then
RS.Close
End IF
RS.Open sql, session("cn"),3,3
ListingCount24h=RS(0)


Line 70:
***************
RS.Open sql, session("cn"),3,3


Edited by - kolucoms6 on 10 May 2007 18:55:21
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 10 May 2007 :  16:57:51  Show Profile  Send ruirib a Yahoo! Message
What was the error message now?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  17:02:19  Show Profile

ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/affnet/Right.inc, line 70

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 10 May 2007 :  17:20:02  Show Profile  Send ruirib a Yahoo! Message
WHat happens if you execute the query directly in Access?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  17:31:41  Show Profile
Works perfectly in Access...

Edited by - kolucoms6 on 10 May 2007 17:49:44
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 10 May 2007 :  17:51:28  Show Profile  Send ruirib a Yahoo! Message
Do you have other ASP pages using the same database? If so, do they work?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  18:06:06  Show Profile
Yes .. Here is the txt file of the ASP page

[LINK DELETED for SECURITY purpose]

Edited by - kolucoms6 on 10 May 2007 18:55:05
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 10 May 2007 :  18:15:54  Show Profile  Send ruirib a Yahoo! Message
The piece of code seems to suggest that you are reusing the same recordset variable. Either post the whole code or I would suggest that you try using a specific recordset variable just to execute that specific query.

On a side note, the use of session variables to store connection strings is not considered a good programming habit.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 10 May 2007 :  18:18:17  Show Profile
You meant to say RS(current Recortdset) and RS1(new one) ?

I didnt get "specific recordset variable just to execute that specific query" ?

And how to use connection string across the application ?(Need a guidance towards it)

Edited by - kolucoms6 on 10 May 2007 18:19:02
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.34 seconds. Powered By: Snitz Forums 2000 Version 3.4.07