Use SqlBulkCopy. The WriteToServer method can read from a datatable.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"AVL" <(E-Mail Removed)> wrote in message
news:3C25D833-863D-4610-A84E-(E-Mail Removed)...
> Hi,
> I've a requirement where in I need to read the data from a csv file and
> load the data into the sql database. The file has around 1 lakh records.
> I'm
> reading 300 records at a time from the file, loading into a dataset.
> From the dataset, I'm reading the rows sequentially,and updating one by
> one
> in to the database. This happens with a sql trnasaction.
>
> The problem is here with the performance.. The file to be loaded exists on
> one server and the database exists on another server. The loading process
> is
> too slow
> and it breaks with the below error
> 'The SqlTransaction is closed;it is no longer usable'.
> I've searched on the google..but couldn't get appropriate resolution. Can
> someone help me out?