Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply


Post by gala_l » Fri 13 Jan 2006 21:29

I want insert in the table of the database some records, for example 10, which I have in the DataSet myDataSet, DataTable "MyTable"

myAdapter.Update(myDataSet, "myTable");
catch (Exception e)

If I have exception situation in record 5, the first four records appeared in the database, but another 6 not. How can I do that if I try update DataSet, and catch exception, nothing appeared in the database? Why RejectChanges doesn't work?

Devart Team
Posts: 133
Joined: Thu 08 Sep 2005 06:27

Post by SecureGen » Mon 16 Jan 2006 07:58

AcceptChanges() method applies changes by DataRow. Thus successfully accepted DataRow becomes unchanged and it can not be rejected by RejectChanges().
In order to obtain behaviour that you expect, use DB transactions. Start new transaction before AcceptChanges() using following code:
PgSqlDirect tr = connection.BeginTransaction();
Then use:
after AcceptChanges() and
after RejectChanges();

You can also try to use HasErrors property of DataTable. See example in the help on this property.

Post Reply