sql query in asp..help pls
new_learner | Posted 2:54am 11. February 2010 Server Time |
May i know what is wrong with the following query:
sSQL="SELECT * FROM Schedules where Release_Name =" & keyword
I am getting following error:
'No value given for one or more required parameters'.
Its pointing to the connection string..which is:
recordset.Open sSQL, connection
I am trying to fetch records from the table. I would like to fetch exact matching record which i enter in the search box..
Any help here is would be very helpful.
This post have been closed for new replies
katy8439 | Posted 5:40am 11. February 2010 Server Time ||
Because you're searching for text, you need to wrap the keyword query in quotes:
sSQL="SELECT * FROM Schedules where Release_Name = '" & keyword &"'"
The above query will only provide an exact match to the keyword entered so if you're searching something that has a variety of words in your field you can use the "Like" parameter"
sSQL="SELECT * FROM Schedules where Release_Name LIKE '%" & keyword&"%'"
It's important to remember to make your search query safe to avoid SQL injection attacks so replace single quotes in the search term before passing it into your query
Hope that helps!
new_learner | Posted 11:43pm 12. February 2010 Server Time |
Thank you for the advice and solution, it worked as expected. I am suggesting all my friends to use this forum to get quick and accurate solutions.
Thanks a lot once again.
Show all replies to 'sql query in asp..help pls'