| | |
Allowing NULL search in SelectCommand of SQLDataSource
Please support our MS SQL advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 19
Reputation:
Solved Threads: 0
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?
Thanks in advance!
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?
MS SQL Syntax (Toggle Plain Text)
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) ?? BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Other Threads in the MS SQL Forum
- Previous Thread: database copying from local to server
- Next Thread: Where is AlwaysUseDefaultCodePage?
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last autogrowth business connectingtodatabaseinuse count cursor data database dateadd datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday






