Author |
Topic  |
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 15:33:35
|
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
|
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. |
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 10 May 2007 : 16:01:01
|
Depending on the DB Engine you are using (and how its set up) the table name could be case-sensitive too. |
 |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 16:03:46
|
1) SubCategory DOES exist
2) DB Engine is Access and using ADO
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 10 May 2007 : 16:14:22
|
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 |
 |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 16:28:18
|
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")
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 16:56:13
|
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 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 17:02:19
|
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
/affnet/Right.inc, line 70
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 17:31:41
|
Works perfectly in Access... |
Edited by - kolucoms6 on 10 May 2007 17:49:44 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 18:06:06
|
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 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 10 May 2007 : 18:15:54
|
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 |
 |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 10 May 2007 : 18:18:17
|
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 |
 |
|
Topic  |
|