I want to return all rows from a SQL Server 2008 database table into a SQL data source if a textBox field is blank. So I made a stored procedure with an if @date IS NULL
clause.
Although the stored procedure seems to be working fine in Visual Studio 2008 the actual webpage displays no results.
I am guessing I have to send a DBNull
value to the stored proc if textBox.Text == string.Empty
. I tried the SqlDataSource1.SelectParameters.Add
but it seems that I get a conversion error from DBNull.Value
to string.
Is this the source of my problems or am I missing something else? How would I pass DBNull.Value
to a stored proc if a textfield is blank?