dt某字段赋值
DataTable dt = ListToDataTable<Test>(t); dt.Columns["password"].DefaultValue = "11111111"; string pvtStrSqlCon = ConfigurationSettings.AppSettings["ConnectionString"].ToString(); var a = SqlBulkCopyByDatatable(pvtStrSqlCon, "[Test].[dbo].[sysUser]", dt); dt.Columns["password"].ColumnName = "ITEMNO"; dt.Columns["one"].ColumnName = "ITEMNO111"; dt.Columns.Add("operateStr"); foreach (DataRow dr in dt.Rows) { //为新添加的列进行赋值 dr["operateStr"] = "A"; }