Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bind RadioButtons to SQL Char Having Y/N
Message
From
12/05/2005 04:52:54
 
 
To
09/05/2005 15:21:30
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01012256
Message ID:
01013286
Views:
13
>I have a WinForms application that has 2 RadioButtons (inside a Group Box).
>One button is for Yes and the other button is for No.
>How might I bind these to a SQL Server Char(1) field having values of 'Y' and 'N'?

The obvious solution would be to convert your Y/N fields to bit and handle the Y/N in your output if and when you have to, but I imagine that's not possible.

If you are using a view, you might try something like:
SELECT ... 
CAST(CASE WHEN UPPER(MyField) = 'Y' THEN 1
          WHEN UPPER(MyField) = 'N' THEN 0
          ELSE NULL 
     END AS Bit) AS MyField FROM ...
You'll have to write additional code to handle updates when the user clicks on one of your buttons.

Just out of curiosity, why would you want to use 2 radiobuttons instead of one checkbox?

HTH

BR
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform