Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以使用 DataRowView 获取列的值
DataRowView row; object value = row["MyColumn"];
当然,如果 DataRowView 中没有“MyColumn”,则此代码会引发异常。
如果该行包含“MyColumn”,如何提前检查?遗憾的是,DataRowView 上没有 row.Contains("MyColumn")。
你可以用这个
dataRowView.Row.Table.Columns.Contains("MyColumn")