using System.Collections.Generic;
using System.Data.SqlClient;
public static void Main()
var dtCustomers = GenerateCustomers(400);
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
using (var bulk = new BulkOperation(connection))
bulk.DestinationTableName = "Customers";
bulk.BulkInsert(dtCustomers);
using (var command = connection.CreateCommand())
var sqlDataAdapter = new SqlDataAdapter(command);
ds.Tables[0].TableName = "1 - Customers";
FiddleHelper.WriteTable(ds.Tables[0]);
public static DataTable GenerateCustomers(int count)
DataTable dtTable = new DataTable("Customers");
dtTable.Columns.Add("CustomerID", typeof(int));
dtTable.Columns.Add("Name", typeof(string));
for(int i = 0; i < count; i++)
var drCustomer = dtTable.NewRow();
drCustomer["CustomerID"] = (i + 1);
drCustomer["Name"] = "Customer_" + i;
dtTable.Rows.Add(drCustomer);
public static void GenerateDatabase()
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
using (var command = connection.CreateCommand())
[CustomerID] [INT] IDENTITY(1,1) NOT NULL,
[Name] [NVARCHAR](MAX) NULL,
CONSTRAINT [PK_Customers] PRIMARY KEY CLUSTERED
command.ExecuteNonQuery();