Hi,

I am trying to do a search function on my GridView. However when I tried using ( LIKE '%' + @ea_name2 + '%' ), it would only return me values if "ea_name2" is not null. I would like that SQL statement to execute even when "ea_name2" is null. Any ideas?

SelectCommand="SELECT * FROM [ea] WHERE ([ea_name] LIKE '%' + @ea_name2 + '%') ORDER BY ea_name"

Thanks in advance!

Did you try SELECT * FROM [ea] WHERE ([ea_name] LIKE '%' + @ea_name2 + '%' or [ea_name] is null) ??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.