【发布时间】:2015-09-29 06:27:15
【问题描述】:
C# : 需要将数据表 id 列获取到字符串列表中
List<string> ids = new List<string>();
ids = dtTable.Rows.OfType<DataRow>().Select(dr => dr.Field<string>("GROUP_ID"))
.Where(dr => dr != null).ToList();
我收到此错误:
无法将“System.Int32”类型的对象转换为“System.String”类型。
如果我将类型更改为 int,则它无法处理 null 值,因此我将类型指定为字符串
【问题讨论】: