我正在使用 vb.net,我想从我的 Windows 窗体中向我的数据库表“adwPays”中插入一行。这是我的代码: Dim CC、EngName、FreName、LanCode As String Dim DialCode As Integer
CC = txtCC.Text
EngName = txtEN.Text
FreName = txtFN.Text
LanCode = txtLC.Text
DialCode = txtDC.Text
Dim MyConn As New SqlConnection("Server=(local);Database=dbAjout;Integrated Security=True")
Dim query As String
query = "INSERT INTO adwPays (CC, Anglais,Francais,CodeLangue,IndicInter) VALUES ( ' " & CC & "','" & EngName & "','" & FreName & "','" & LanCode & "','" & DialCode & " ');"
Dim cmd As New SqlCommand(query, MyConn)
MyConn.Open()
cmd.ExecuteScalar()
MyConn.Close()
但是它给了我这个错误“System.Data.dll中发生了'System.Data.SqlClient.SqlException'类型的未处理异常
附加信息:字符串或二进制数据将被截断。该语句已终止。”
有什么帮助吗?