我花了太多时间来处理此错误,但无法在此处找到错误
Adapter = New MySqlDataAdapter("Insert into tbluser(UserID,Name,UserType,Password) values('" & txtUserId.Text & "' ,'" & txtName.Text & "','" & cmbUserType.Text & "','" & "',AES_ENCRYPT('" & txtpass.Text & "','x'))", connection)
答案 0 :(得分:0)
Adapter = New MySqlDataAdapter("Insert into tbluser (UserID
,Name
,UserType
,Password)
values( '" & txtUserId.Text & "'
, '" & txtName.Text & "'
, '" & cmbUserType.Text & "'
, '" & "'
, AES_ENCRYPT('" & txtpass.Text & "','x'))", connection)
您拥有的值多于您要定义的要插入的列。看起来问题是UserType和Password之间的空字段。像这样修改它应该解决列计数错误:
Adapter = New MySqlDataAdapter("Insert into tbluser ( UserID
, Name
, UserType
, Password)
values( '" & txtUserId.Text & "'
, '" & txtName.Text & "'
, '" & cmbUserType.Text & "'
, AES_ENCRYPT('" & txtpass.Text & "','x'))"
, connection)