Eivo Posted December 20, 2006 Share Posted December 20, 2006 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 More sharing options...
aspnetguy Posted December 20, 2006 Share Posted December 20, 2006 sql ="SELECT * FROM table WHERE name LIKE '%" & Request.QueryString("value") & "%'" Link to comment Share on other sites More sharing options...
Eivo Posted December 20, 2006 Author Share Posted December 20, 2006 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 More sharing options...
aspnetguy Posted December 20, 2006 Share Posted December 20, 2006 sorry I assumed you were using vbscript, change the & to + and you should be fine. Link to comment Share on other sites More sharing options...
Eivo Posted December 20, 2006 Author Share Posted December 20, 2006 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 More sharing options...
aspnetguy Posted December 20, 2006 Share Posted December 20, 2006 well you never learn if you don't ask questions You will catch on the more you play with it Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now