Concurrently violation

H

HungTrinh

Hi All,

I use CommandBuilder to create UpdateCommand. But it raise a
"Concurrently violation" error. Could you tell us how to solve this problem.
This error rarely happen.

private static int Update(string name, DataRow row, string connection)
{
using(OleDbConnection cn = new OleDbConnection(connection))
{
cn.Open();
OleDbCommand cmd = new OleDbCommand(name, cn);
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
cmd.CommandType = CommandType.TableDirect;
OleDbCommandBuilder sqlBuilder = new
OleDbCommandBuilder(adapter);
adapter.UpdateCommand = sqlBuilder.GetUpdateCommand();

return adapter.Update(new DataRow[]{row});
}
}

Thanks,
Hung
 
M

Miha Markic [MVP C#]

Hi,

It depends on updatecommand - it returns 0 as records updated count.
I suggest you to create the update command manually instead of using
commandbuilder.
So you'll know what is going on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top