Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CASE like T-SQL Statement?
Message
From
16/07/2003 11:47:58
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00810234
Message ID:
00810699
Views:
12
I haven't done too much VFP stuff lately, but we did develop a little DBA utility to set up our SQL Server database, to apply updates to it, to create SP's etc, and it was written in VFP (simply because I wrote it a year and a half ago before I was fluent in C# and so it was easier). I had to make some modifications to it a few weeks ago. It's amazing how many times I kept sticking a ; at the end of my VFP statements. <g>

~~Bonnie


>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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform