asp.net updatecommand problems: please help

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top