Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 18, 2012 11:22 AM by Hunain Hafeez
Nov 17, 2012 08:37 PM|LINK
i have a search box , whose value txtbox1.Text is used as a filter in where clause, so gridview returns results on the basis of name entered in textbox but user would have to enter exact and full name in text box otherwise no record displays but i want that
even if user enters few sequential letters then it should display all matching records in gridview,
e.g if user enters Joh instead of Johnny , then on entering Joh , it should display Johnny and other similar names
SelectCommand="SELECT [userid], [fullname], [email], [question], [answers], [doc], [roleid],[active] FROM [tblUser] where fullname=@emplyrName AND roleid=2"
Nov 17, 2012 10:57 PM|LINK
use the sql keyword "like" in conjunction with a wildcard. If you don't know what those are, I've heard good things about the book, Teach Yourself SQL in 10 Minutes.
Once you've got that part figured out your next task will be to make the search case insensitive.
Nov 18, 2012 12:55 AM|LINK
Nov 18, 2012 02:06 AM|LINK
SelectCommand="SELECT [userid], [fullname], [email], [question], [answers], [doc], [roleid],[active] FROM [tblUser] where (fullname Like @emplyrName+'%') AND roleid=2"
Nov 18, 2012 11:22 AM|LINK
thanks man and it is working case insensitively even i didn't thought about it but is doing dearch insensitively !