There is a method

private void dataGuests_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { MySqlConnection conn = new MySqlConnection(connStr); string SqlQuery = "select * from guests ORDER BY id DESC;"; MySqlDataAdapter adapter = new MySqlDataAdapter(SqlQuery, connStr); DataSet DS = new DataSet(); try { conn.Open(); adapter.Update(DS, "guests"); //adapter.Fill(DS, "LoadDataBinding"); } catch (MySqlException ex) { MessageBox.Show("Error: " + ex); } finally { conn.Close(); } } 

When you run the application swears at:

An unhandled exception of type "System.InvalidOperationException" in System.Data.dll.
Additional information: Update operations could not find TableMapping ["guests"] or DataTable "guests".

I read it , but the designer selects all the data from the same table and fills it in the Grid. And correctly. Checked in the table PRIMARY KEY - in stock.

I ask to send a lost wanderer

  • Read professorweb.ru/my/ADO_NET/base/level2/2_4.php , I will say from experience that the RU SO community stopped answering simple questions, unfortunately (although the main goal of any SO is to help people), try to figure it out on your own. - Align
  • four
    You have created an empty dataset. Naturally, it does not have a guests table. - Alexander Petrov
  • you created an empty DataSet table, but did not put anything in it - Garrus_En

1 answer 1

Not

 MySqlDataAdapter adapter = new MySqlDataAdapter(SqlQuery, connStr); 

but

 MySqlDataAdapter adapter = new MySqlDataAdapter(SqlQuery, conn);