I have a combobox with 3 values: All
, Failed
, Completed
.
ALL
: load All rows and no condition.
Failed
and
DECLARE @status varchar(15)
--set the status
SELECT *
FROM tbl_Location
WHERE Status = @status OR @status = 'ALL'
Make your combo-box to send a parameter call @status. Send @status = null when you need to load all row.
Select *
from tbl_location
where @status is null or status = @status;