Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-01-17 : 09:15:54
|
| Raj writes "Hi guys,I am building an ASP page which (apart from other things) will contain a drop down list box listing the search criterias and a text box to enter the search string. For example the drop down list box can contain First name, Last Name, City, Country etc., so the user needs to select a criteria first and then enter the text.My question is that I need to build the SQL statement based on the search criteria and the search text.Something like -Select * from <tablename> where <Dropdownlist.SelectedItem.value> like <TextBox.Value>I am having problems in placing the correct quotes (both single and doubleI tried this but it doesnt work - "Select * from Employees where '"+ DropDownList1.SelectedItem.Value +"' like '"+ Textbox1.text +"'"what is wrong with this ? Can someone guide me as to how this is done ?" |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-01-17 : 09:39:43
|
| In VBDim strSQLstrSQL = "Select * from Employees where " & _DropDownList1.SelectedItem.Value & " like " & Replace(Textbox1.text,"'","''")But from your syntax it looks like you're trying to create this on the client side.You can get at the form values in asp using the Request Object.Edited by - ValterBorges on 01/17/2003 09:48:23 |
 |
|
|
|
|
|