Hi,
I have a form that has collection of drop down lists , text boxes and search button.When i select any one of dropdown list or textbox and click on search,
it should be queried based on the single parameter passed and taking other values as null.I am not getting the logic in implementation of Stored Procedure,Can u please help me with that?Thanks in Advance.
Regards,
Sivapratap

Jignesh TrivediRank #16 · 50.3K reputationPosted Apr 13, 2014, 11:40 PM EDT
hi,
I think, In this case you can use Optional parameter in SQL stored procedure.
Please refer below link for mare detail
http://weblogs.asp.net/stanleygu/archive/2010/02/08/solution-5-implementing-optional-parameters-in-t-sql-stored-procedures.aspx
hope this will help you.
Posted Apr 11, 2014, 4:32 AM EDT
kindly pass DbNull.Value value to the parameter those you want to pass null, the sql parameters is not accepting .net's null value so you have to pass DbNull.Value
Example:
SqlParameter sp=new SqlParameter();
Sp.Value=DbNull.Value;
Kindly accept as answer, if it helps you
sivapratap Kurapati91 reputationPosted Apr 13, 2014, 11:31 PM EDT
sivapratap Kurapati91 reputationPosted Apr 14, 2014, 7:23 AM EDT