471,305 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 software developers and data experts.

C# Bit problem

Hi,

In my SQLServer 2000 MyDataBase.MyTable, there's one field MyStatus which
datatype is Bit(1).
So the MyStatus in MyTable is either 0 or 1.
Now I have a ComboBox MyCombo in MyForm, and there're two items "Yes" and
"No". Where "Yes" represents 0 in MyTable.MyStatus, and "No" represents 1
in MyTable.MyStatus.
How do update MyStatus from MyCombo? I can't find any conversion in C# to
Bit.
Thanks for help.
Jason
Nov 28 '05 #1
1 1323
Hi,

The Bit(1) SQL data type translates to bool in C#. So you can use a bool
which you set to true or false. True will be 1 in the Bit, and false
will be 0.

So for your example, you need a bool, which you set to true if the user
selects "No", and to false, if the user selects "Yes".

Hope that helps,

-Lenard

Jason Huang wrote:
Hi,

In my SQLServer 2000 MyDataBase.MyTable, there's one field MyStatus which
datatype is Bit(1).
So the MyStatus in MyTable is either 0 or 1.
Now I have a ComboBox MyCombo in MyForm, and there're two items "Yes" and
"No". Where "Yes" represents 0 in MyTable.MyStatus, and "No" represents 1
in MyTable.MyStatus.
How do update MyStatus from MyCombo? I can't find any conversion in C# to
Bit.
Thanks for help.
Jason

Nov 28 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Kostatus | last post: by
117 posts views Thread by Peter Olcott | last post: by
18 posts views Thread by Ian Stanley | last post: by
28 posts views Thread by Jon Davis | last post: by
6 posts views Thread by Ammar | last post: by
2 posts views Thread by Mike Collins | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.