Results 1 to 3 of 3

Thread: Odd SQL behaviour

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Odd SQL behaviour

    Heres my query:

    Code:
    SELECT *
    FROM tblDownloads
    INNER JOIN tblSection
    ON tblDownloads.guidSectionID = tblSection.guidSectionID
    WHERE (tblDownloads.guidCategoryID = 5)
    ORDER BY strSection
    Here are the tables, there is a tad bit more fields but they are irrelivant so I did not specify them:
    Code:
    tblDownloads = (guidDownloadID, guidSectionID, strTitle)
    tblSections = (guidSectionID, strSection)
    Now, the thing is... this join works. How do I know that? Well, if i get strSection, a result pops up! However, when I try to get guidSectionID, it gives me an error.

    ADODB.Recordset error '800a0cc1'

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

    /Admin/showDownloads.asp, line 40
    I really need to get guidSectionID, and all i have to say at this point is ***?

    Any help would be appriciated,

    Thanks a lot guys and gals
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    The only thing I can think of - the SQL statement is returning two guidSectionId fields. ADO cannot determine which one you want

    If field names are the same ADO would probably change the names to make sure they are unique. Something like Expr1 etc..
    You could loop through the Fields collection just to see what ADO is naming the fields and then adjust accordingly.

    Other than that, don't use Select * but be more specific with the select list

    Select tblDownLoads.*, strSection

  3. #3

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    Yes you are a genius! That is 100% correct. It didn't even occur to me that I'm trying to get two tables with the identical name. To solve this problem, I switched the table names around adding a P for parameter at the end of the name. Works great


    thanks alot Bruce, you just made my day!
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width