dcsimg
is there a way to return a list of successfully updated values after batch update
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sum_r
Posted On:   Wednesday, June 18, 2008 05:52 AM

I have a list of id's which i need to insert to database using batchUpdate


ID is a primary key


List a id's contain many repeated entries.so insertion of this ID fails.


Is thr a way through which i get the list of ID which failed to insert.

becas the program which i use, once the exception is thrown... loop is not continuing.

Re: is there a way to return a list of successfully updated values after batch update

Posted By:   Stephen_McConnell  
Posted On:   Wednesday, June 18, 2008 01:30 PM

It would seem from describing your code, you have the "try/catch" block outside your loop. Put a try/catch block inside your loop and when you catch the exception where the id already exists, ignore it and go to the next ID.


This takes a hit on performance, because try/catch blocks always do, but if you have a bunch of duplicate records, then you have a problem with your data.


Stephen McConnell

About | Sitemap | Contact