• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with SQL statement

milehigh

Senior member
set strCats = Request.QueryString("cats")
sqlCats = "SELECT * FROM subCats where ID = strCats "

ID is an autonumber primary key in an Access DB.
I've tried it as
sqlCats = "SELECT * FROM subCats where ID = strCats "
sqlCats = "SELECT * FROM subCats where ID = '" & strCats &"'"

It works if I enter as....
sqlCats = "SELECT * FROM subCats where ID = 2"

I tried strCats=Cint(Request.QueryString("cats") as well and that didn't work either.

Any suggestions??
 
You're trying to compare a number to the string "cats". You need to use the the field that contains the text "cats" in the where clause.

So something like sqlCats = "SELECT * from subCats where Description = '" & strCats & "'"

EDIT: Those are single quotes in the where clause BTW to qualify it as text 😉.
 
After my hosting company 'suggested' I do my troubleshooting locally I finally get it figured out.

Thanks for the reply!!
 
Back
Top