Here is code
//create Sql connection
//create Sql command
//tablename is the name of table in database
source is the datatable
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(conneection , SqlBulkCopyOptions.Default, command.Transaction))
{
bulkCopy.DestinationTableName = tablename;
bulkCopy.NotifyAfter = 1000;
bulkCopy.BulkCopyTimeout = 100;
bulkCopy.WriteToServer(source);
bulkCopy.Close();
}
No comments:
Post a Comment