【发布时间】:2020-11-25 10:33:49
【问题描述】:
我有 DataTable 与日期列。我想知道如何在不使用循环的情况下将列的默认值设置为当前日期。
我检查了下面的代码,但我想知道下面代码中的“值”是什么
var col = result.Columns.Add("Column1", typeof(CellObject));
col.DefaultValue = new CellObject { Value = null };
更新代码2:-
var col = ds1.Tables[0].Columns.Add("LastUpdatedDateTime", typeof(DateTime));
col.DefaultValue = DateTime.Today;
【问题讨论】:
-
这能回答你的问题吗? stackoverflow.com/questions/27956513/…
-
检查我上面的 ccmets
-
您需要在 CellObject 构造函数中查看 Value 是什么类型。
-
CellObject是什么? -
我在上面试过了,但还是不行
标签: c#