Jump to content

Query String Variable


Eivo

Recommended Posts

Is it possible to have a query string to look up based on a variable? Like this kinda....SELECT * FROM table WHERE name LIKE variableIf you can, how do you format it. I have been testing a few way, but can't get it to work. Mine looks like this right nowSELECT * FROM table WHERE name LIKE Request.QueryString("value")

Link to comment
Share on other sites

sql ="SELECT * FROM table WHERE name LIKE '%" & Request.QueryString("value") & "%'"

You're Awesome.But now I have an error.ADODB.Recordset error '800a0bb9'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another./mfvfd/article_index.asp, line 87 I don't fully understand why I am getting this error. If I manually put in the value I need, I get the desired results. But as soon as I replace the value with the variable (which, have the same value as before) I get this error. Let me illustrate.
var find = "SELECT * FROM mfvfd WHERE category='firesafety'";recordset.Open(find,connectionObject);

var find = "SELECT * FROM mfvfd WHERE category LIKE 'firesafety'";recordset.Open(find,connectionObject);

Those both work like they should. However as soon as I change it to this...

var find = "SELECT * FROM mfvfd WHERE category LIKE '%" & Request.QueryString("cat") & "%'";recordset.Open(find,connectionObject);

var find = "SELECT * FROM mfvfd WHERE category LIKE country='" & Request.QueryString("cat") & "'";recordset.Open(find,connectionObject);

Then I start getting the error. The URL looks like this,.../article_index.asp?cat=firesafetyand I even tried,.../article_index.asp?cat='firesafety'but nothing. Any help would be awesome.

Link to comment
Share on other sites

sorry I assumed you were using vbscript, change the & to + and you should be fine.
You rock! Thanks.god, I wish I understood this better. I feel like I am always on this board asking questions.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...