c# - dynamic query generated by stored procedure or function -
i have grid 4 columns i.e title, description, keyword, date in c#.net search button , textbox.
when write title+description+keyword+date return related data clicking search button.
if write keyword+date +keeping description , title null return related data grid. , on other combination's of 4 column.
that is, it's searching fields in each column , combination changes dynamically
i want stored procedure or function in sql server. suggestion?.. in advance
you can create procedure 4 parameters (each options) , following sql
create proc search( @title varchar(20) null, ... select * your_table (title = @title or @title null) etc.
anyway, should parse input values each parameter. when pass null @title parameter condition (title = @title or @title null)
true.
Comments
Post a Comment