Hi friends,
Newbie here,
Irrespective of the case i want to search for the name entered in the textbox in asp.net. If the name exists even partially like for example if only Beena is enter where as the complete name is Beena Paul or if only Paul is entered irrespective of the case typed in .. The result should come. How do i write the query for that plzz help
Loading
Sam HobbsPosted Aug 10, 2011, 7:04 PM
Priya LingePosted Aug 10, 2011, 6:46 AM
You enter the string in Textbox.
string str=textbox1.Text;
string s = str + "%";
string query = "select ClientName from Client where ClientName like '" + s + "' order by ClientName";
This way you search the name.
Hope this will help you.
Thanks.
Jiteendra SampathiraoPosted Aug 10, 2011, 4:25 AM
SELECT * FROM Persons
WHERE name LIKE 'sa%'
you will get this type of names
sampathi, santhosh etc..
refer LINK
Om prakash SinghPosted Aug 10, 2011, 4:23 AM
If you enter Paul then the query will return all the names which contains paul.
If you enter Beena Paul then the query will return all the names which contains beena paul.
So just try the query.
Nethra R SPosted Aug 10, 2011, 3:48 AM
But what if only 1 part of the full name or half the name is entered .. How to write query for that?
Jiteendra SampathiraoPosted Aug 10, 2011, 3:39 AM
convert the value to either upper case or lower case like TextBox.Text.ToLower() or TextBox.Text.ToUpper().........
this is the good practise.......
Om prakash SinghPosted Aug 10, 2011, 3:26 AM
Use query like this, u will get the result