我正在尝试在我的数据库中插入数据tbl_admin
,我收到了这样的错误:
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;userid=root;password=;database=vbdb"
Try
MysqlConn.Open()
COMMAND.Connection = MysqlConn
COMMAND.CommandType = CommandType.Text
COMMAND.CommandText = "INSERT INTO vbdb.tbl_admin (LastName, FirstName, MiddleName, UserName, Admin_Password) VALUES (@lName,@fName,@mName,@username,@password)"
COMMAND.Parameters.AddWithValue("@lName", stflname.Text)
COMMAND.Parameters.AddWithValue("@fName", stffname.Text)
COMMAND.Parameters.AddWithValue("@mName", stfmiddlename.Text)
COMMAND.Parameters.AddWithValue("@username", stfusername.Text)
COMMAND.Parameters.AddWithValue("@password", stfpassword.Text)
COMMAND.ExecuteNonQuery()
MsgBox("New Employee Data Saved")
clearFields()
MysqlConn.Close()
Catch ex As Exception
MysqlConn.Close()
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try