Groups | Blog | Home
all groups > c# > april 2007 >

c# : BulkCopy


Ender
4/5/2007 11:42:00 PM
For Primary keys exception:

bc.WriteToServer(dt, DataRowState.Added);
(for DataTable)

but what do we write for DataReader?
bc.WriteToServer(dr,?);

Husam Al-A''araj
4/6/2007 4:00:01 AM
Hi,
http://www.codeproject.com/cs/database/SqlBulkCopy.asp

Hope this will help

Regards,
Husam Al-A'araj

[quoted text, click to view]
Ender
4/6/2007 4:18:01 AM
I haven't any problem about using BulkCopy.My problem is "primary key control".

Record which have new id will be insert on new row.
Record which have id on destination table will be update.

they are for datatable: bc.WriteToServer(dt, DataRowState.Added);
bc.WriteToServer(dt, DataRowState.Modified);

But I use SqlDataReader: bc.WriteToServer(dr);

Are there any ideas?

Thnks.


[quoted text, click to view]
AddThis Social Bookmark Button