我正在尝试将表单中的值插入到我的数据库中。在表中,我已将 Zavrseno 声明为位类型。我从复选框中获取 Zavrseno 值作为表单中的布尔类型。当我执行查询时出现错误:“将 varchar 值 ' True ' 转换为数据类型位时转换失败。”
Dim t1 As DateTime = Me.VrijemePocetkaDateTimePicker.Text
Dim t2 As String = Me.Tim1TextBox.Text
Dim t3 As String = Me.Tim2TextBox.Text
Dim t4 As Boolean = Me.ZavrsenoCheckBox.Checked
cmd = New SqlCommand("insert into dbo.Utakmice(VrijemePocetka,Tim1,Tim2,Zavrseno) values(' " & t1 & " ', ' " & t2 & " ' ,' " & t3 & " ' ,' " & t4 &" ')", conn)