cusimar9
08-02-2005, 09:12 AM
I'm trying to do something incredibly simple but I'm having no luck
I have 2 tables, an item table and a category table. They are connected by the field 'CategoryNo'. There are 'Description' fields in both tables.
I'm trying to do an SQL query and retrieve all the fields, but it won't let me specify the Description field in the Category table.
The error I get is "Item cannot be found in the collection corresponding to the requested name or ordinal. "
Here is my code:
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")
Set rsDatabase = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Item.Description, Category.Description FROM Item LEFT JOIN Category ON Item.CategoryNo = Category.CategoryNo;"
rsDatabase.Open strSQL, adoCon
Do While not rsDatabase.EOF
Response.Write (rsDatabase("Category.Description")) ** Causes error
rsDatabase.MoveNext
Loop
I have 2 tables, an item table and a category table. They are connected by the field 'CategoryNo'. There are 'Description' fields in both tables.
I'm trying to do an SQL query and retrieve all the fields, but it won't let me specify the Description field in the Category table.
The error I get is "Item cannot be found in the collection corresponding to the requested name or ordinal. "
Here is my code:
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")
Set rsDatabase = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Item.Description, Category.Description FROM Item LEFT JOIN Category ON Item.CategoryNo = Category.CategoryNo;"
rsDatabase.Open strSQL, adoCon
Do While not rsDatabase.EOF
Response.Write (rsDatabase("Category.Description")) ** Causes error
rsDatabase.MoveNext
Loop