日期:2014-05-17 浏览次数:20386 次
DataTable dt = new DataTable();
DataColumn dc1 = new DataColumn("NAME", typeof(string));
DataColumn dc2 = new DataColumn("SIZE", typeof(string));
dtProductDetail.Columns.Add(dc1);
dtProductDetail.Columns.Add(dc2);
DataRow dr = dtProductDetail.NewRow();
dr["NAME"] ="AAA";
dr["SIZE"] = "123";
dt.Rows.Add(dr);
SqlBulkCopy.ColumnMappings.Add("NAME", "NAME");
SqlBulkCopy.ColumnMappings.Add("SIZE", "SIZE");
SqlBulkCopy.DestinationTableName = "Table_A";
SqlBulkCopy.WriteToServer(dt);