DataGridView

Ginanity

Newcomer
Joined
Nov 30, 2006
Messages
9
I'm using a datagridview in my application that get's data from a MySql Server (not localhost) via the ODBC 3.51 driver. Now i'm trying to update the mysql server with the changed data in the datagridview using a dataset

Code:
           OpenConnection();
            initInfo();
            string _sql = "SELECT * FROM " +tabel;
            da = new OdbcDataAdapter(_sql, con);
            OdbcCommandBuilder _cb = new OdbcCommandBuilder(da);
            if (ds.HasChanges() == true)
            {
                da.Update(ds);
                ds.AcceptChanges();
            }
            CloseConnection();

I get following error:
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.

The problem is that I have no idea what table or rows are in the datagridview because the user can add a mysql database and the application generates a listview with the tables. On click the selected table appears in the datagridview.

So i can't use the update statement or use a datatable...
 
Back
Top