Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CASE like T-SQL Statement?
Message
 
To
16/07/2003 11:32:33
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00810234
Message ID:
00810696
Views:
11
Yep, This week I'm at a VFP client and not doing .NET work.

It's fun to keep going back and forth.

__Stephen

>You're welcome , Stephen ... I assume you're talking about the switch case?
>
>
>>Thanks Bonnie. That may do it?
>>
>>>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 :
>>>        //code here
>>>        break;
>>>
>>>    // however many case statements you need
>>>
>>>    // the default is optional
>>>    default :
>>>        // code here
>>>        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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform