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

Re: Concurrently violation by Miha

Miha
Fri Mar 11 01:20:46 CST 2005

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.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

"HungTrinh" <hungtv@pmail.vnn.vn.invalid> wrote in message
news:edBETdgJFHA.1176@TK2MSFTNGP12.phx.gbl...
> 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
>
>