I'm working on a project where you can add users to a database with the INSERT INTO command and an Acces database (OleDB).
I'm having an 0x80040E14
error which I can't seem to get solved.
Code below:
public void AddUser()
{
OleDbConnection DATABASE_CONNECTION = new OleDbConnection(CONNECTION_STRING);
try
{
DATABASE_CONNECTION.Open();
String SQL_QUERY = "INSERT INTO Users(Username, Password, Voornaam, Tussenvoegsel, Achternaam, Email, VolledigeNaam) VALUES(?, ?, ?, ?, ?, ?, ?)";
OleDbCommand COMMAND = new OleDbCommand(SQL_QUERY, DATABASE_CONNECTION);
COMMAND.Parameters.AddWithValue("Username", OleDbType.Char).Value = Username;
COMMAND.Parameters.AddWithValue("Password", OleDbType.Char).Value = Password;
COMMAND.Parameters.AddWithValue("Voornaam", OleDbType.Char).Value = Voornaam;
COMMAND.Parameters.AddWithValue("Tussenvoegsel", OleDbType.Char).Value = Tussenvoegsel;
COMMAND.Parameters.AddWithValue("Achternaam", OleDbType.Char).Value = Achternaam;
COMMAND.Parameters.AddWithValue("Email", OleDbType.Char).Value = Email;
COMMAND.Parameters.AddWithValue("VolledigeNaam", OleDbType.Char).Value = VolledigeNaam;
int rows = COMMAND.ExecuteNonQuery();
DATABASE_CONNECTION.Close();
if (rows > 0)
{
MessageBox.Show("User added");
}
else
{
MessageBox.Show("FAIL");
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}