Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding Checkbox to nchar column
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01445996
Message ID:
01446011
Vues:
31
>>>>>>Hi,
>>>>>>
>>>>>>I have a column in a table of type nchar(1). The value in this column is "A" or "I". I want to bind this column to a check box and show in the caption of the check box "Active" (for 'A') and "Inactive" for 'I'
>>>>>>
>>>>>>I tried the following binding code but get error:
>>>>>>
>>>>>>
>>>>>>this.chkStatus.DataBindings.Add("Checked", bindingSource1, "Status=='A'");
>>>>>>
>>>>>>
>>>>>>What am I doing wrong? TIA.
>>>>>
>>>>>Why not make your life easier and just change the type of the column to bit 1=Active 0=Inactive?
>>>>>True and False.
>>>>
>>>>Good point, Borislav. When I was writing the question I thought about the same. But I am sure, even if I change this column to a bit type there will be future cases where I may need to bind a check box to a string column.
>>>>Thank you.
>>>
>>>But how complex that could be?
>>>CheckBox has 3 values:
>>>True
>>>False
>>>NULL
>>>
>>>So you could handle it with a simple bit field that allow NULL :-)
>>
>>Excellent point, again. Thank you. (So, I see you moved to .NET world too. I am glad I am in a good company :)).
>
>No,
>I just know SQL Server :-)

Then, before they put handcuffs on me for violating the forum etiquette <g>, quick question. In order to change the column in SQL Server from char to bit and not to lose the existing values, I would have to create a temp column to hold the values, right?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform