Update fails

Update fails

Postby tomcat2001 » Wed 10 Sep 2008 20:38

We are having a problem with the PgSqlDataAdapter.Update method failing. Here's the situation we have. We are loading data into a dataset with this data adapter. And then the data later changes. We then setup the commands using a PgSqlCommandBuilder.

Now here's where I'm lost as to what happens because it's kind of a black box. We call Update on the data adapter for the datatable in question. I've subscribed to the RowUpdating event and so I am looking at that since that's the logical choice for something going wrong. And I'd be correct but I don't know why.

The update statement is something crazy:
"UPDATE tablename SET id = :p1, visit_id = :p2, code = :p3, description = :p4, modifier1 = :p5, account = :p6, omit = :p7, taxable = :p8, status = :p9, units = :p10, unit_charge = :p11, charges = :p12, taxes = :p13, adjustments = :p14, payments = :p15, balance = :p16 WHERE ((id = :p17) AND (visit_id = :p18) AND (code = :p19) AND (description = :p20) AND (modifier1 = :p21) AND (account = :p22) AND (omit = :p23) AND (taxable = :p24) AND (status = :p25) AND (units = :p26) AND (unit_charge = :p27) AND (charges = :p28) AND (taxes = :p29) AND (adjustments = :p30) AND (payments = :p31) AND (balance = :p32))"

And that all looks fine. So then I look at the parameters here in the event and that's the problem. When I look at say the p15 parameter, the value is not correct. I can look at the row it says it's updating and I can see the correct value in it. Is there something obvious we're missing here? I tried running the sample and I get exceptions trying to run it so I can't really try that either.
tomcat2001
 
Posts: 21
Joined: Wed 10 Sep 2008 20:29

Postby tomcat2001 » Thu 11 Sep 2008 12:42

Nevermind. It would appear that the grid was not saving the data back to the row until I switched rows. For some reason it showed the data there when looking in the debugger.
tomcat2001
 
Posts: 21
Joined: Wed 10 Sep 2008 20:29

Postby Shalex » Thu 11 Sep 2008 13:14

Please post here the SQL script that creates tables and fills them with data. It would be even better if you send me (alexsh at devart.com) test project with this table in DataSet.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL