hi every body
I have a SelectCommand and i use code below to set it value
and i defin the parameters with code:Code:DataAdapter.SelectCommand.Parameters["@code"].Value = str_code;
now i want when str_code is null SelectCommand retrieve all records in database but i dont want to use condition statments becaus i have many parameters and then i have to write about 100 if-thenCode:DataAdapter.SelectCommand.CommandText = "SELECT * FROM Table where (code= @code)"; DataAdapter.SelectCommand.Parameters.Add("@code", SqlDbType.NVarChar, 50, "code");
i need a T-SQL for doing it
thank you all.


Reply With Quote
Bookmarks