Problem accessing QueryString [modified]
-
Please help. Here is the record layout of my Access Database. ID VENDNO VENDOR BEL COL HAR JEF MOR SUPNO SUPPLY On my webpage I have an image of a five county area in Ohio with hotspots. (BEL, COL, HAR, JEF, MOR are those counties)When a visitor clicks on a county (the link looks like ?county=COL) then I want the code to show every vendor that does not have an "X" in the corresponding county. Here is the code I have so far: <% Set connectionToDatabase=Server.CreateObject("ADODB.Connection") connectionToDatabase.ConnectionTimeout=60 connectionToDatabase.Open "DSN=ICDC_Brands" Set recordSet=Server.CreateObject("ADODB.Recordset") recordSet.Open "SELECT * FROM vendor", connectionToDatabase if Request.QueryString("county") = "" then Response.Write("") elseif Request.QueryString("county") <> "" then Do While NOT recordSet.EOF I think this is problem line --> If recordSet("Request.QueryString") <> "X" Then Response.Write(recordSet("VENDOR") & "<br>") end if recordSet.MoveNext Loop end if connectionToDatabase.Close Set connectionToDatabase=Nothing %> When I visit the page and click on a county, the web browser says: ADODB.Recordset error '800a0cc1' Item cannot be found in the collection corresponding to the requested name or ordinal. /test/brands.asp, line 110 Any thoughts would be appreciated. Thank you
modified on Wednesday, February 10, 2010 3:47 PM
-
Please help. Here is the record layout of my Access Database. ID VENDNO VENDOR BEL COL HAR JEF MOR SUPNO SUPPLY On my webpage I have an image of a five county area in Ohio with hotspots. (BEL, COL, HAR, JEF, MOR are those counties)When a visitor clicks on a county (the link looks like ?county=COL) then I want the code to show every vendor that does not have an "X" in the corresponding county. Here is the code I have so far: <% Set connectionToDatabase=Server.CreateObject("ADODB.Connection") connectionToDatabase.ConnectionTimeout=60 connectionToDatabase.Open "DSN=ICDC_Brands" Set recordSet=Server.CreateObject("ADODB.Recordset") recordSet.Open "SELECT * FROM vendor", connectionToDatabase if Request.QueryString("county") = "" then Response.Write("") elseif Request.QueryString("county") <> "" then Do While NOT recordSet.EOF I think this is problem line --> If recordSet("Request.QueryString") <> "X" Then Response.Write(recordSet("VENDOR") & "<br>") end if recordSet.MoveNext Loop end if connectionToDatabase.Close Set connectionToDatabase=Nothing %> When I visit the page and click on a county, the web browser says: ADODB.Recordset error '800a0cc1' Item cannot be found in the collection corresponding to the requested name or ordinal. /test/brands.asp, line 110 Any thoughts would be appreciated. Thank you
modified on Wednesday, February 10, 2010 3:47 PM
-
Please help. Here is the record layout of my Access Database. ID VENDNO VENDOR BEL COL HAR JEF MOR SUPNO SUPPLY On my webpage I have an image of a five county area in Ohio with hotspots. (BEL, COL, HAR, JEF, MOR are those counties)When a visitor clicks on a county (the link looks like ?county=COL) then I want the code to show every vendor that does not have an "X" in the corresponding county. Here is the code I have so far: <% Set connectionToDatabase=Server.CreateObject("ADODB.Connection") connectionToDatabase.ConnectionTimeout=60 connectionToDatabase.Open "DSN=ICDC_Brands" Set recordSet=Server.CreateObject("ADODB.Recordset") recordSet.Open "SELECT * FROM vendor", connectionToDatabase if Request.QueryString("county") = "" then Response.Write("") elseif Request.QueryString("county") <> "" then Do While NOT recordSet.EOF I think this is problem line --> If recordSet("Request.QueryString") <> "X" Then Response.Write(recordSet("VENDOR") & "<br>") end if recordSet.MoveNext Loop end if connectionToDatabase.Close Set connectionToDatabase=Nothing %> When I visit the page and click on a county, the web browser says: ADODB.Recordset error '800a0cc1' Item cannot be found in the collection corresponding to the requested name or ordinal. /test/brands.asp, line 110 Any thoughts would be appreciated. Thank you
modified on Wednesday, February 10, 2010 3:47 PM
I think the problem is with this line:
Response.Write(recordSet("VENDOR") & "<br>")
As I can see VENDOR is the table name from database. You can try using some column name from VENDOR table.
"Legacy code" often differs from its suggested alternative by actually working and scaling. —Bjarne Stroustrup
-
I think the problem is with this line:
Response.Write(recordSet("VENDOR") & "<br>")
As I can see VENDOR is the table name from database. You can try using some column name from VENDOR table.
"Legacy code" often differs from its suggested alternative by actually working and scaling. —Bjarne Stroustrup
-
sduffield wrote Please help. Here is the record layout of my Access Database. ID VENDNO VENDOR BEL COL HAR JEF MOR SUPNO SUPPLY actually he already mentioned the table structure so you can see the "VENDOR" column. thatraja
:-O :-O :doh: My bad. Missed that one.
"Legacy code" often differs from its suggested alternative by actually working and scaling. —Bjarne Stroustrup
-
:-O :-O :doh: My bad. Missed that one.
"Legacy code" often differs from its suggested alternative by actually working and scaling. —Bjarne Stroustrup
-
I think the problem is with this line:
Response.Write(recordSet("VENDOR") & "<br>")
As I can see VENDOR is the table name from database. You can try using some column name from VENDOR table.
"Legacy code" often differs from its suggested alternative by actually working and scaling. —Bjarne Stroustrup