SqlBulkCopy

If you have a large amount of data to transfer to SQL Server, you can use the SQL bulk copy feature. I copied an example below from ASPM 2026.

public void sendToDatabase(DataTable dt)
{
    using (SqlBulkCopy bulk = new SqlBulkCopy(Conn.DbConn))
    {
        bulk.DestinationTableName = "MyDatabase.dbo.MyTable";
        bulk.ColumnMappings.Add("SourceField1", "DestinationField1");
        bulk.ColumnMappings.Add("SourceField2", "DestinationField2");
        bulk.ColumnMappings.Add("SourceField3", "DestinationField3");
        bulk.WriteToServer(dt);
    }
}