![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Help Understanding INNER JOIN I have this script that seems to work until; rsSchools.Open "SELECT * FROM Schools INNER JOIN Students ON Schools.StdntID=Students.StdntID", Cnnct, 3, 3 However when I go to reference a field it bombs! On Response.Write rsSchools("StdntID") i get the following message! ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal. I know the join works because the rsSchools.RecordCount returns the right number of records. Why do I bomb on my Response.Write rsSchools("StdntID") ? Thanks for the help in advance Leona |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Help Understanding INNER JOIN "Leona Leal Educator" <LeonaLealEducator@xxxxxx> wrote in message news:9EB33F21-70FD-4041-BBD8-8DA86E72EB87@xxxxxx Quote: >I have this script that seems to work until; > > rsSchools.Open "SELECT * FROM Schools INNER JOIN Students ON > Schools.StdntID=Students.StdntID", Cnnct, 3, 3 > > However when I go to reference a field it bombs! > > On Response.Write rsSchools("StdntID") i get the following message! > > ADODB.Recordset (0x800A0CC1) > Item cannot be found in the collection corresponding to the requested name > or ordinal. > > I know the join works because the rsSchools.RecordCount returns the right > number of records. > > Why do I bomb on my Response.Write rsSchools("StdntID") ? > > Thanks for the help in advance > > > Leona return try specifying the field names you require. rsSchools.Open "SELECT Students.StdntID as studentID, Students.fieldName2 FROM Schools INNER JOIN Students ON Schools.StdntID=Students.StdntID", Cnnct, 3, 3 etc |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Help Understanding INNER JOIN "Leona Leal Educator" wrote: Quote: > rsSchools.Open "SELECT * FROM Schools INNER JOIN Students ON > Schools.StdntID=Students.StdntID", Cnnct, 3, 3 > > On Response.Write rsSchools("StdntID") i get the following message! > ADODB.Recordset (0x800A0CC1) > Item cannot be found in the collection corresponding to the requested name > or ordinal. But just as a general rule you should always give the explicit list of fields you need in your SELECT. It would be highly unusual to actually *need* all the field in both tables in your VBS code, and you can gain efficiency (sometimes a lot) by only transferring needed data. Having said all that... It's also true that for *some* databases ADO will allow you to do Response.Write rsSchools("Students.StdntID") and separate the tables via the recordset field selector. Whether it works or not depends on whether the SQL query to the given DB returns the table info for each field or not. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| LINQ: Inner Join & Left Outer Join Q | .NET General | |||
| Help understanding one liner | VB Script | |||
| Understanding the WLM newsreader | Live Mail | |||
| UAC problem - Need a little help and a lot of understanding | Vista security | |||
| Understanding Vista | Vista General | |||