Last post Dec 30, 2010 02:27 PM by wangxg26
Dec 20, 2010 08:40 AM|wangxg26|LINK
I'm buidling dropdown search box for a field in a database table. How can I code search all in web form and Stored procedure?
Dec 20, 2010 09:31 AM|r.rajeshkhunt|LINK
Say user have selected All in dropdownlist.
Now user click on search, you need to check the value of selected one, if that one equals to 'All', pass null.
In SP, check like below
Country.Name = IsNull(@Country, Country.Name)
@Country - dropdownlist value you pass as a parameter
Country.Name is the name of country table with which you want to match
Dec 20, 2010 07:58 PM|wangxg26|LINK
Thank you for your suggestion. I was using the following SP to search for one state. So How can I modify it to search for ALL state and also able to search one state at one time? Thank you,
ALTER PROCEDURE [dbo].[GetAllPhoneBySearch]
@State varchar (50)
Dec 24, 2010 02:53 AM|Wencui Qian - MSFT|LINK
You can set an extra state e.g. ALL in dropdownlist, and validate it in sp, and if it's ALL, you can know to search ALL for it. Otherwise, a certain state is choosed. Thanks.
Dec 30, 2010 02:27 PM|wangxg26|LINK
Can you give some pseudo code? Thanks,