Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bind RadioButtons to SQL Char Having Y/N
Message
De
12/05/2005 04:52:54
 
 
À
09/05/2005 15:21:30
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01012256
Message ID:
01013286
Vues:
14
>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform