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.
Author |
Topic |
Fu
Starting Member
23 Posts |
Posted - 2005-11-13 : 08:27:17
|
I have a a search form formed of:5 Textboxes1 dropdownlist1 checkbox1 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 optionsThe select clause is always stableThe from clause is always stablewhat'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.Valuewhere (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 |
 |
|
|
|
|