I'm using SqlBulkCopy
in order to copy a datatable into a database table, because the data is over 250,000 rows.
But I am facing a problem. I need to make condition for the process of copying data.
For example If The Code Equal '1111' then don't copy this row
I can't write this with SQL query statements like Insert Into
because this will take too much time.
Here is my code:
SqlBulkCopy blk = new SqlBulkCopy(myConnectionString);
try
{
blk.DestinationTableName = "myTable";
blk.WriteToServer(myDataTable);
}
catch (Exception ex)
{ MessageBox.Show(ex.Message, "System Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
Please any one can help me :)