Hi all,
When inserting a row everything goes okay.
But when I delete that same row again using the radgridview contextmenu option Delete Row
Then the debugger shows the following error massage:
'System.Data.DBConcurrencyException: 'Concurrency violation: the DeleteCommand affected 0 of the expected 1 records.''
My code is below.
What am I doing wrong?
Chris.
public partial class mainForm : Form
{
public static OleDbConnection con3 = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source = " + Application.StartupPath + "\\parts.accdb");
public static DataTable dt = new DataTable();
public OleDbDataAdapter adapter;
public OleDbCommandBuilder commandbuider;
public mainForm()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string SQL = "SELECT * from supplier";
adapter = new OleDbDataAdapter(SQL, con3);
commandbuider = new OleDbCommandBuilder(adapter);
adapter.Fill(dt);
PartsGrid.DataSource = dt;
PartsGrid.RowsChanged += new GridViewCollectionChangedEventHandler(PartsGrid_Update);
}
private void PartsGrid_Update(object sender, GridViewCollectionChangedEventArgs e)
{
if (adapter.Update(dt) > 0)
{
MessageBox.Show("done");
}
}
}