0

I am new to handling databases with C# and I want to update a row in the database.

Here is the code:

using (OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=DPW.MDB;Persist Security Info=True;Jet OLEDB:Database Password=xxxxxx"))
        {
            connection.Open();
            OleDbCommand cmd = connection.CreateCommand();

            cmd.Parameters.Add(new OleDbParameter("@googleId", googleID));
            cmd.Parameters.Add(new OleDbParameter("@appointmentId", appointmentId));

            cmd.CommandText = "UPDATE Appointments SET GoogleId = @googleId WHERE AppointmentId = @appointmentId";

            cmd.ExecuteNonQuery();
            cmd.Parameters.Clear();

The database is not updated after I execute it.

A. Savva
  • 632
  • 10
  • 30
  • Do it this way: http://stackoverflow.com/a/11910114 – Robert Harvey Aug 09 '16 at 15:34
  • I changed the question. Now I don't get any errors, but it is not updated in the database. – A. Savva Aug 09 '16 at 15:56
  • Could it be possible that there is an error in your connection string ? In here : `Persist Security Info=True;Jet OLEDB:Database Password=xxxxxx`, should the `:` be a `;`. I might be wrong, I'm not an expert of OLEDB connection strings. – Noémie Lord Aug 09 '16 at 16:11

0 Answers0