Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Search Form

Author  Topic 

Fu
Starting Member

23 Posts

Posted - 2005-11-13 : 08:27:17
I have a a search form formed of:
5 Textboxes
1 dropdownlist
1 checkbox
1 search button
---------------------
the check box's role is just to hide or show two text boxes
-------------------------------------------------------------
in the sqlcommand:
i am going to select the same attributes with any kind of search options
The select clause is always stable
The from clause is always stable
what's changing is the where clause
--------------------------------------------------------------
if i want to create an sqlcommand for all the possible combinations of the given parameters that would be hell. any ideas on how to create the where clause in accordance with the textboxes filled and the dropdownlist status?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-13 : 08:31:55
for paramteres you don't use you pass them as DBNull.Value

where (col1 = @testboxValue1 or @testboxValue1 is null) and
(col2 = @testboxValue2 or @testboxValue2 is null) and
(col3 = @ddlValue1 or @ddlValue1 is null)


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -