Connecting Tech Pros Worldwide Forums | Help | Site Map

asp.net updatecommand problems: please help

news.microsoft.com
Guest
 
Posts: n/a
#1: Nov 18 '05
first i apologize for the potential crosspost. this group gets far more
traffic. now that i have that out of the way... ;)

apparently using AutoGenerated Commands on Command objects does not work if
you use a stored procedure or commandtext that contains one or more inner
joins. im trying to implement a workaround that goes fine up to a particular
step.

I have a dataset that I bring to the client. This selectcommand statement
contains inner joins. i let the user make changes on the client then send
the dataset back for processing. this works fine.

behind the scenes, i query for a second, "comparison" dataset that *does
not* contain inner joins. this dataset contains the table's primary key,
along with 2 columns that I am going to update.the primary key for this
dataset matches the primary key for the first dataset.

i loop through the first dataset, and compare each column row by row. if the
keys match, then i change the field's value in the comparison dataset to the
value contained in the first dataset.

i then call adapter.update, and here is where it fails. I receive an error:
"column MyColumn is constrained to be unique. Value of 'MyValue' already
exists.".

It looks like the adapter is trying to also update the Primary Key field. I
am not sure why this is happening, since I do not change the primary key
value anywhere in code. I was under the impression that only those fields
that had changes would update.

Does this make sense? What step am I missing?




Closed Thread