Help, please, I try to delete the data through DataGridView, there is an error Violation of parallelism: DeleteCommand affected 0 of the expected 1 records. Here is the code:

OleDbConnection _connection = new OleDbConnection(); StringBuilder ConnectionString = new StringBuilder(""); ConnectionString.Append(@"Provider=Microsoft.Jet.OLEDB.4.0;"); ConnectionString.Append(@"Extended Properties=Paradox 5.x;"); ConnectionString.Append(@"Data Source=C:\Teplo\TepSeti\;"); _connection.ConnectionString = ConnectionString.ToString(); try { _connection.Open(); } catch { MessageBox.Show("Error openning database! "); } OleDbDataAdapter adapter1 = new OleDbDataAdapter("SELECT * FROM Tepotp", _connection); adapter1.DeleteCommand = new OleDbCommand("DELETE FROM Tepotp"); adapter1.DeleteCommand.Connection = _connection; adapter1.Update(dataset5.Tables[0]); _connection.Close(); 

    1 answer 1

    Use OleDbCommandBuilder to get valid commands. He needs to feed the adapter associated with the table through SelectCommand , he will read its schema and generate commands to add an update, delete.