0

I'm having an issue with updating my database using my C# form. I have an Access database (containing employee info) connected to my project, and I'd like to allow the user to update their specific information. I have it set up where it'll run an Update query whenever the user enters a different parameter in the textbox. Unfortunately, whenever I try to run it I get the following error: "Could not find installable ISAM".

The Access database is a .accdb file and is not password protected. I tried reinstalling the Microsoft Access 2010 Distribute driver and I even converted a copy of the database to .mdb. I also tried changing the target machine from Any CPU to x86 and x64. Closest I got doing either method was running the program on x64 with the .mdb database, though even this returns another error: "'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine". Besides, I'd prefer to keep the .accdb file anyway.

OleDbConnection sql = new OleDbConnection();
sql.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\[Path].accdb; Persist Secuity Info=False";
OleDbCommand cmd = new OleDbCommand();

        try
        {
            if (textBox5.Text != "" | textBox5.Text != Form1.username)
            {
                    sql.Open();
                    cmd.Connection = sql;
                    cmd.CommandText="UPDATE Staff SET Username = @username WHERE ID = " + textBox1.Text;
                    cmd.Parameters.AddWithValue("@username", textBox5.Text);
                cmd.ExecuteNonQuery();
                sql.Close();
            }

Ideally, the update query should run, allowing me to update that specific record of the database.

Thanks a bunch, guys!

Volkmar Rigo
  • 1,158
  • 18
  • 32
stevereno
  • 1
  • 3

0 Answers0