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

Om prakash Singh126 reputationPosted Aug 9, 2011, 11:26 PM EDT
Use query like this, u will get the result
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Aug 9, 2011, 11:39 PM EDT
convert the value to either upper case or lower case like TextBox.Text.ToLower() or TextBox.Text.ToUpper().........
this is the good practise.......
Nethra R SRank #6,347 · 269 reputationPosted Aug 9, 2011, 11:48 PM EDT
But what if only 1 part of the full name or half the name is entered .. How to write query for that?
Om prakash Singh126 reputationPosted Aug 10, 2011, 12:23 AM EDT
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.
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Aug 10, 2011, 12:25 AM EDT
SELECT * FROM Persons
WHERE name LIKE 'sa%'
you will get this type of names
sampathi, santhosh etc..
refer LINK
Priya LingeRank #785 · 2.9K reputationPosted Aug 10, 2011, 2:46 AM EDT
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.
Sam HobbsRank #108 · 20.5K reputationPosted Aug 10, 2011, 3:04 PM EDT