bulk update to db in asp.net 2.0 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

bulk update to db in asp.net 2.0

rkharikrishnanrkharikrishnan Posts: 1Member

I was working on a task where we need to insert upto 3 lakhs of records to a table at one time. I am using ASp.Net 2.0 and SQL server 2005

I was trying to pass the data to the sql stored procedure as xml and do the insertion inside the SP.

The xml is of following structrure

The P tag is recurring and it can be up to 3 lakhs of records.

I am creating the xml from two listbox values. The value of pid comes from one listbox and value of sid comes from another listbox. The actual thing here doing is mapping the items in both database together.

Take the first value of first list box and map to all the values in second listbox, then take 2nd value and map to all values in second listbox and so on..

But even the xml creation itself is take too much of time, when both listbox contains 500 items each.

Is there any way i can achive this.

I was planning to check SqlBulkCopyin ADO.Net. But here one issue is some records which we are tyring to insert will already be in the database table and inserting them again will show Primary key error.

I am not sure how the sqlBulkcopy will behave is such error occures while inserting.

Can anyone please help me

Sign In or Register to comment.