Stephen,
T-SQL supports CASE ... check it out in BOL. I guess I'm unclear as to whether you're wanting this in a Stored Proc or in your C# code. From the looks of what you've posted here, it looks like you're trying to form a SQL command to pass to your backend maybe? (I don't do it this way, as I always use SP's ... but that's another topic <g>).
Anyway, C# has a case statement ... it's called "switch case" and (you can look it up in help, but ...) the syntax is:
switch (expression)
{
case constant-expression :
break;
default :
break;
}
Not sure if this helps or not, but I gave it my best shot. <g>
~~Bonnie
>Thanks Bonnie.
>
>I am not at their site right now but its kind of like this in foxpro:
>lcstring = iif(ddlist1.SelectedText = "LEFT","L.H.",iif(ddlist1.SelectedText = "RIGHT","R.H.",.....))+" "+ ddlist2.SelectedText +" "+ ........
>
>So a Case like statement in a T-SQL command is what I'm trying to do. I'm going to be using the StringBuilder too.
>
>
>
>>Stephen,
>>
>>Maybe I'm being particularly dense today, but I don't understand what you're asking. Could you elaborate more?
>>
>>~~Bonnie
>>
>>
>>>I need to build a string for a WebForm display. I have a need for a CASE statement to take the display from a drop down and concatinate it ie:
>>>LEFT = L.H. RIGHT = R.H.
>>>
>>>I am combining 7 different dropdowns for this user request, and this is the sticking point I have so far.
>>>
>>>Any ideas?
>>>
>>>TIA
>>>
>>>__Stephen