how to retrieve checked value of checkbox from sql server 2005 using C# on windows form
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hemant KumarPosted Jun 29, 2012, 8:09 AM
Dim query As String = "INSERT INTO TABLENAME (CheckBoxColumn) VALUES (@CheckBoxColumn)"
Dim conn As New SqlClient.SqlConnection("Connection String")
Dim cmd As New SqlClient.SqlCommand(query, conn)
If CheckBox1.Checked = True Then
cmd.Parameters.Add("@CheckBoxColumn", SqlDbType.Bit).Value = 1
Else
cmd.Parameters.Add("@CheckBoxColumn", SqlDbType.Bit).Value = 0
End If
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
You can get connection string from http://www.connectionstrings.com.