How to specify checkbox data for saving to a bit field
<p>If a checkbox produces TRUE or FALSE, how do I convert to 1 or 0 to save the value to the database?</p>

<p>ASP.NET</p>

<pre><code>&lt;asp:CheckBox ID="cbTermsandcond" runat="server" /&gt;
</code></pre>

<p>C#</p>

<pre><code>    BTermsandcondParam = new SqlParameter();
    BTermsandcondParam.ParameterName = "@BTermsandcondParam";
    BTermsandcondParam.SqlDbType = SqlDbType.Bit;
    BTermsandcondParam.Direction = ParameterDirection.Input;
    BTermsandcondParam.Value = cbTermsandcond. ???  ; 
</code></pre>

<p>EDIT:</p>

<p>I wrote this which worked.  But is there a simplier way?</p>

<pre><code>    if (cbTermsandcond.Checked == true)
    {
        BTermsandcondParam.Value = 1; 
    }
    else
    {
        BTermsandcondParam.Value = 0;
    }
</code></pre>

<p>Regards
Tea</p>
