using (SqlConnection Bulkconn = new SqlConnection(conn.ConnectionString))
{
Bulkconn.Open();
using (SqlBulkCopy sqlBC = new SqlBulkCopy(Bulkconn))
{
sqlBC.DestinationTableName = "dbo." + dt.TableName;
foreach (DataColumn dc in dt.Columns)
{
sqlBC.ColumnMappings.Add(dc.ColumnName, dc.ColumnName);
}
sqlBC.WriteToServer(dt);
}
}
沒有留言:
張貼留言