C# Forum

Ask Question   UnAnswered
Home » Forum » C#       RSS Feeds

Can't update access database from C#

  Asked By: Edward    Date: Dec 09    Category: C#    Views: 1427

I am working through the C# tutorial from Hoome and learn. I am able to read records OK, but when I atempt to update an access database I get an error. The database is not read only,
System.Data.OleDb.OleDbException was unhandled
Message=Operation must use an updateable query.

private void btnSave_Click(object sender, EventArgs e)
System.Data.OleDb.OleDbCommandBuilder cb;
cb = new System.Data.OleDb.OleDbCommandBuilder(da);

DataRow dRow = ds1.Tables["Workers"].NewRow();

dRow[1] = textBox1.Text;
dRow[2] = textBox2.Text;
dRow[3] = textBox3.Text;


MaxRows = MaxRows + 1;
inc = MaxRows - 1;

con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Workers.mdb";

da.Update(ds1, "Workers");

MessageBox.Show("Entry added");



1 Answer Found

Answer #1    Answered By: Edward Smith     Answered On: Dec 09

OK I got it. Simply moved the database out of the root of C (Windows 7)

Didn't find what you were looking for? Find more on Can't update access database from C# Or get search suggestion and latest updates.