I have a SQL command that filters the output on a GridView.
SELECT * FROM [ProductIncluded] WHERE (ISNULL(@GFMerchantProductName2,'') = '' OR [GFMerchantProductName] LIKE '%' + @GFMerchantProductName2 + '%')
I want to show all the records in the gridview when the ASP:textbox (passing control variable @GFMerchantProductName2) is empty.
Therefor I have now put in the ISNULL statement. This does the trick for if I test the SQL statement alone, however if I test in the ASP form it returns no records. This implies (but may not be the case) that the empty textbox is returning some empty data rater than a null. I have ensured that the control parameter has ConvertEmptyStringToNull Set as True and DefaultValue=""
How can I get the gridview to show all records if the textbox is empty. (i.e set @GFMerchantProductName2 or add isBlank(@GFMerchantProductName2 ) type statement to the SQL.