| re: Update-Insert DetailsView, result is duplicating lines
OK, you are using the actual DetailsView control, which I am not familiar with. Apologies, I thought you meant "details view" in a generic way and might be using a Forms.DataGridView with which I am more familiar.
Hopefully someone with more experience can help you. Nonetheless, sounds like ItemUpdating may be getting called twice...coders familiar with the control know these quirks and will tell you in a heartbeat.
In the meantime, maybe you could add some Trace statements to the ItemUpdating event handler and see if indeed it is getting called twice. Perhaps (longshot) after executing your sql it fires the updating event again? Try removing the "UPDATE part of your logic, so that it only inserts new records. If you don't get a duplicate, then it might mean it was firing an INSERT followed by an UPDATE for some reason.
Good luck.
|