Author |
Topic |
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 22 April 2009 : 08:09:08
|
Here's a bit of SQL that I'm getting an 800a0cc1 ("Item cannot be found in the collection corresponding to the requested name or ordinal.") error on. I've looked at this until I'm blue in the face and cannot see why.
strSql="SELECT M.M_EMAIL, M.M_NAME, M.MEMBER_ID, T.T_AUTHOR, T.T_SUBJECT, T.TOPIC_ID FROM " & strMemberTablePrefix &_
"MEMBERS M INNER JOIN " & strTablePrefix & "TOPICS T ON M.MEMBER_ID=T.T_AUTHOR WHERE T.TOPIC_ID="& Topic_ID
|
Edited by - Carefree on 22 April 2009 08:09:36 |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 22 April 2009 : 08:10:53
|
are you sure the Topic_ID exists ? |
|
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 22 April 2009 : 08:12:22
|
Yes, the topic exists. |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 22 April 2009 : 08:25:07
|
can't see anything wrong with it at all, what does strSQL think it is when you execute the query ? |
|
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 22 April 2009 : 09:05:52
|
The Topic_ID number is filled in properly, nothing else gets past the error. I decided to simply break it up and rewrite it into two routines and now it works. No idea what was causing the error. |
|
|
SiSL
Average Member
Turkey
671 Posts |
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 22 April 2009 : 09:45:22
|
Here's the output:
quote:
SELECT M.M_EMAIL, M.M_NAME, M.MEMBER_ID, T.T_AUTHOR, T.T_SUBJECT, T.TOPIC_ID FROM FORUM_MEMBERS M INNER JOIN FORUM_TOPICS T ON (M.MEMBER_ID=T.T_AUTHOR AND T.TOPIC_ID=577)
Result of attempted execution is the same:
quote:
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
|
|
|
SiSL
Average Member
Turkey
671 Posts |
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 22 April 2009 : 09:51:42
|
First I don't see why the JOIN clause needs a logical AND with the topic ID, but that should cause the error.
I would guess the error is not when the execution occurs, but when you try to access a field that wasn't selected. I would guess a misspelled field name, likely. |
Snitz 3.4 Readme | Like the support? Support Snitz too |
|
|
SiSL
Average Member
Turkey
671 Posts |
Posted - 22 April 2009 : 09:53:52
|
Oh Rui is right, if you try to take some other field like T_LAST_POST etc. from TOPICS that didnt make it in SQL statement, you might end up like that.
|
|
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 22 April 2009 : 10:06:53
|
Well, here's the entire routine. All the fields are retrieved perfectly when I break it into two parts, but the error persists when using a join. As you'll see, I don't call any fields which weren't specified and the column titles are correct.
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 22 April 2009 : 10:34:17
|
You shouldn't include the table aliases when referencing the fields; that's what's causing the error:
strT2=rsPost("T_SUBJECT")
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
SiSL
Average Member
Turkey
671 Posts |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 22 April 2009 : 11:15:30
|
it generaly helps if you provide all the code that is erroring would have saved a lot of time. |
|
|
SiSL
Average Member
Turkey
671 Posts |
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 22 April 2009 : 15:17:28
|
Well, that was it, alright. But it never got to those line numbers to report an error - it always reported the error at the set rs line. If the silly debugger would (for once) report the actual line number with an error, it would sure help.
I love those error in line number 0 (or in a line number greater than exists in the file with the supposed error) reports. Somebody needs to write a debugger which works as well as the old Commodore basic version. If there was an error, you knew EXACTLY where it was. |
|
|
Topic |
|