You execute the method WriteToServer, and the following error is thrown:
Value cannot be null.
// Oops! The destination name is null
string destinationName = null;
using(var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
{
connection.Open();
using (var sqlBulk = new SqlBulkCopy(connection))
{
sqlBulk.DestinationTableName = destinationName;
sqlBulk.WriteToServer(dt);
}
}
string destinationName = "Customers";
using(var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()))
{
connection.Open();
using (var sqlBulk = new SqlBulkCopy(connection))
{
sqlBulk.DestinationTableName = destinationName;
sqlBulk.WriteToServer(dt);
}
}