ASP.NET - How to edit 'bit' data type?

Posted by Peter on Stack Overflow See other posts from Stack Overflow or by Peter
Published on 2009-10-22T15:43:58Z Indexed on 2010/04/19 22:53 UTC
Read the original article Hit count: 182

Filed under:
|
|

I am coding in Visual Basic. I am using a checkbox control. Now depending on its checked property I need to set/unset a bit column in a SQL Server database. Here's the code:

    Try
        conSQL.Open()

        Dim cmd As New SqlCommand("update Student set send_mail = " + _
            sendemailCheckBox.Checked.ToString + " where student_id = '" _
            + sidnolabel.Text + "'", conSQL)

        cmd.ExecuteNonQuery()
    Finally
        conSQL.Close()
    End Try

The send_mail attribute is of bit datatype. This code is not working. How do I go about it?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about database