I need to know if there is a way to pass a variable as a field name in a select statement. I was handed a database that I can't change, that I need to perform queries on based on a specific column and what the data is in that column. In this case the number 1.
I have the following code that I can't seem to get to work.
services = Request.QueryString ("services")
RESOURCE_INFO = "SELECT agency_name, agency_address, agency_city, agency_zip, agency_phone" & _ "FROM agency WHERE services = '" & 1 & "' ORDER BY agency_name"
The services variable can be 40 different column names (that are in the database), which is passed from a form. I can't get the variable to work. Restructuring the database is out of the question.
Any ideas?
I have the following code that I can't seem to get to work.
services = Request.QueryString ("services")
RESOURCE_INFO = "SELECT agency_name, agency_address, agency_city, agency_zip, agency_phone" & _ "FROM agency WHERE services = '" & 1 & "' ORDER BY agency_name"
The services variable can be 40 different column names (that are in the database), which is passed from a form. I can't get the variable to work. Restructuring the database is out of the question.
Any ideas?