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";
            }

 

posted @ 2021-06-30 13:32  饮水思源^0^  阅读(97)  评论(0编辑  收藏  举报