Hi everyone
I am writing a program using c# and connecting to microsoft access. I get this Data type mismatch in criteria exception and cant find the problem. Can anyone help me please?
My Code:
>
try
> {
> myCommand = new OleDbCommand();
> myCommand.CommandType = CommandType.Text;
> myCommand.CommandText = "INSERT INTO Customers(Name, Adress1, Adress2, Adress3, PostCode)" +
> "VALUES('" + tbxNameCust.Text + "','" + tbxAdresCust.Text + "','" +
> tbxAdress2.Text + "','" + tbxAdress3.Text + "','" + tbxPosCust.Text + "')";
> myCommand.Connection = myConnection;
> myConnection.Open();
> myCommand.ExecuteNonQuery();
>
> MessageBox.Show("Customer successfully added.", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
> }
> catch (Exception e3)
> {
> MessageBox.Show("Error saving new Customer.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
> }
> finally
> {
> myConnection.Close();
> }