Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have a search functionality in a project with Nhibernate framework,

when passing the value for search is it possible to ignore case for example

If "CodeProject" is in database ,

if i pass like "%Co%" it sends me the result "CodeProject" , but if i pass "%co%" it sends me null
Posted
Updated 2-May-11 17:54pm
v2
Comments
Ashishmau 3-May-11 0:28am    
What u r trying to do.
Database itself is case insensitive

1 solution

Try to convert case of the filed in same case.., for example see the below Query:

"select text from mytable upper(text)='" + txtSearch.Text.ToUpper() + "'";
 
Share this answer
 
Comments
CodeHawkz 3-May-11 4:37am    
Good answer, but please, don't use string concatenation in SQL. Very bad practice :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900