G
Guest
Hi all,
Im using a SQLDataAdapter with custom select, update and insertqueries which
i assume work (as they are simple SQL statements).
I use this adapter to fill a table. I also add a few more columns, and set
up primary keys. I make updates to this table. I do this by queuing the data
to be added up, and then calling beginloaddata, loaddatarow per queue item,
and finally endloaddata. I then call update on the datatable to send these
updates to the database. Unfortunately Im not getting the behavior I expect.
My understanding of loaddatarow was that it uses the primary key values to
determine if a row exists to amend - if not then it creates the row instead.
However, this only seems to happen if you set the acceptchanges argument on
loaddatarow to true. If I do this, however, then the table seems to forget
which were the new/changed rows (while debugging the status of the row reads
"unchanged") and so no updates get sent.
If I set this flag to false then endloaddata throws an exception since I may
have added two rows with the same primary keys (when what I really want to
do is update a row that may have already been newly added in this batch of
loaddatarow calls, if you see what I mean).
Is my understanding of this incorrect?
Spammy
Im using a SQLDataAdapter with custom select, update and insertqueries which
i assume work (as they are simple SQL statements).
I use this adapter to fill a table. I also add a few more columns, and set
up primary keys. I make updates to this table. I do this by queuing the data
to be added up, and then calling beginloaddata, loaddatarow per queue item,
and finally endloaddata. I then call update on the datatable to send these
updates to the database. Unfortunately Im not getting the behavior I expect.
My understanding of loaddatarow was that it uses the primary key values to
determine if a row exists to amend - if not then it creates the row instead.
However, this only seems to happen if you set the acceptchanges argument on
loaddatarow to true. If I do this, however, then the table seems to forget
which were the new/changed rows (while debugging the status of the row reads
"unchanged") and so no updates get sent.
If I set this flag to false then endloaddata throws an exception since I may
have added two rows with the same primary keys (when what I really want to
do is update a row that may have already been newly added in this batch of
loaddatarow calls, if you see what I mean).
Is my understanding of this incorrect?
Spammy