Mmmm....
It can more complicated but... maybe this simple approach can feed your
needs: Create an stored procedure with all the search params that you need,
set the default value of each param to NULL.
Now in the select where you filter use this approach (pseudo SQL here):
DECLARE My Store Proc
MyParam1 Int = NULL,
MyPAram2 varchar(80) = NULL,
(...)
SELECT ...
FROM ...
WHERE
(MyParam1 IS NULL OR tablefield1 = MyParam1)
AND
(MyParam2 IS NULL OR tablefield1 = MyParam2)
By using this approach you control if the param has been informed using
the IS NULL and the OR switch, and you avoid having chunking T-SQL IF
statements.
/// ------------------------------
/// Braulio Diez
///
///
http://www.tipsdotnet.com
/// ------------------------------
"thomson" wrote:
Hi All,
i have a sit which deals with cars, and i have a table
associated with this, i do have a problem in designing the
application, i have lot of places in the web page where it hits the
the same table but the criteria (parameters) will be different,
Can some body help me out in designing a class which suits the above
purpose , or sugggest me Best Practices for the same
Thanks in advance
thomson