469,623 Members | 997 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

asp.net updatecommand problems: please help

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?

Nov 18 '05 #1
0 881

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Stephen Cairns | last post: by
2 posts views Thread by Mark | last post: by
3 posts views Thread by Jim in Arizona | last post: by
5 posts views Thread by Peter W Johnson | last post: by
reply views Thread by stuart_dent | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.