我正在尝试创建一个简单的注册表单,其中来自文本框等的数据被输入到一个名为的表中users
:
user_id int
username nchar(20)
password nchar(20)
... more columns
代码:
Dim Username As String = txtUsername.ToString
... more variable declarations
lblDOB.Text = DOB.ToString
lblDOB.Visible = True
Dim ProjectManager As String = "test"
... more constant declarations
Dim conn As New SqlConnection("...conn string...")
sqlComm = "INSERT INTO users(Username, Password, ...other columns...)" +
"VALUES(@p1, @p2, ...other params...)"
conn.Open()
registerSQL = New SqlCommand(sqlComm, conn)
registerSQL.Parameters.AddWithValue("@p1", Username)
... other AddWithValues
registerSQL.ExecuteNonQuery()
我收到此错误消息:
字符串或二进制数据将被截断。该语句已终止。