开发者

Bool type in SQL Server 2008

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?

开发者_如何学Go

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";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜