In my DB I have a row UserActive
. It is supposed to be bool. SQL Server does not support bool data type. The similar or close to it is bit
0/1. Ok if I'll make this column bit typed, then how I can handle with it in my C# code? Should I use bool type in my code?
Example
if (ud.UserActive != true)
{
lblUserActive.Text = "Disactivated";
}
else
{
lblUserActive.Text = "Activated";
}
or
if (ud.UserActive == 1)
{
lblUserActive.Text = "Activated";
}
else
{
lblUserActive.Text = "Disactivated";
}
Thank you for reply
Second one. C# is very strongly typed.
lblUserActive.Text = ud.UserActive != 0 ? "Activated" : "Not Activated";
精彩评论