views:

295

answers:

0

I want to make my program robust by putting concurrency check, but somehow UpdateCommand fails me even in the most basic update sql. Using Npgsql 2.0.2

var dax = new NpgsqlDataAdapter();
using (var dtStore = delta.Tables["brand"].GetChanges(DataRowState.Modified))
if (dtStore != null)
{
    dax.UpdateCommand = new NpgsqlCommand(
@"update brand set abbrev = abbrev WHERE 1 = 0", c, tx);


    Console.WriteLine("src {0}", dtStore.Rows.Count); // 1
    Console.WriteLine("updated {0}", dax.Update(dtStore)); // 1

    // doesn't report any error, but it should show DBConcurrencyException error right?
}

[EDIT]

preloadreader=true on NpgsqlConnection string fixed the problem

clue found here: http://pgfoundry.org/tracker/index.php?func=detail&aid=1010379&group_id=1000140&atid=590

But i found a warning on other sites about preloadreader. "Similarly using PreloadReader option in Npgsql is less performant and scales badly to large resultsets."

Francisco Figueiredo jr. what's your thoughts on this?

[UPDATE]

the problem is fixed in Npgsql 2.0.5, don't need the preloadreader anymore in connection string. kudos to Figueiredo and other coders behind Npgsql project.