searching the database sql server dynamically
Posted on 2012-03-21
i have an asp.net website with the 3 tier, and i have connect sql server database with it. now im implementing the search crateria, i have put 3 checkboxlist controls on the page. and also have two text boxes one for searching postcode and other for any business like Mcdonalds or pizza hut etc, and a search button.
my question is that when a user enter a post code or a business name or any of them can be empty as well, and also when the user select any of the checkbox in the checkbox list , as he can select either one or two or as many as he wants, so how i will make a stored procedure in sql server depending on the checkboxes selected in the checkboxlist. like if two checkboxes selected then the stored procedure should return me the result only for them two checkboxes, if more then return for them more its depends on the checkboxlist.
Any help appreciated as i am stuck now.