简单的写入SQL的问题
代码如下
我的复选框在写入时有误
Dim con As SqlConnection = New SqlConnection("server=dengshutong;database=MYTESTDATABASE;integrated security=SSPI")
Dim insertstr As String = "INSERT INTO dbo.开模型材库 VALUES(" & _
"'" & txtID.Text & "'," & _
"'" & txtName.Text & "'," & _
"'" & txtGender.Text & "'," & _
"'" & txtAddress.Text & "'," & _
"'" & txtZipCode.Text & "'," & _
"'" & DateTimePickerBirthday.Value & "'," & _
"'" & txtMaritalStatus.Text & "'," & _
"'" & DateTimePickerHireDate.Value & "'," & _
NumericUpDownHireSalary.Value & "," & _
NumericUpDownCurrentSalary.Value & "," & _
"'" & DateTimePickerRaiseSalary.Value & "'," & _
> "'" & checkbox1.checked & "'," & _
> "'" & checkbox2.checked & "'," & _
"'" & txtDepartment.Text & "')"
Dim insertcmd As New SqlCommand(insertstr, con)
Try
con.Open()
insertcmd.ExecuteNonQuery()
MessageBox.Show("已经成功新增数据记录。", _
"恭喜您", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show(ex.ToString(), "请注意", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Finally
con.Close()
End Try