sql - How to insert big chunk of data into db? -


i using nopcommerce , arvixe hosting.

i have xml file contains products site (about 26000 records). wrote plugin allows me add records using sql script.

the problem is: time of request ends , first 500 - 1000 records appears in db. recommend? maybe should move code different place (not in plugin)?

try sqlbulkcopy:

using (sqlconnection destinationconnection = new sqlconnection(connectionstring)) {     destinationconnection.open();      using (sqlbulkcopy bulkcopy = new sqlbulkcopy(destinationconnection))     {         bulkcopy.destinationtablename = "dbo.bulkcopydemomatchingcolumns";         try         {             // reader sqldatareader has 26000 records             bulkcopy.writetoserver(reader);         }         catch (exception ex)         {             console.writeline(ex.message);         }                 {             reader.close();         }     } } 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -