9

I can get the value of a column in a DataRowView using

DataRowView row;
object value = row["MyColumn"];

of course, if there is no "MyColumn" in the DataRowView, this code throws an exception.

How do I check in advance, if the row contains "MyColumn"? Sadly there is no row.Contains("MyColumn") on DataRowView.

Sam
  • 28,421
  • 49
  • 167
  • 247

1 Answers1

25

You can use this

dataRowView.Row.Table.Columns.Contains("MyColumn")
Fredrik Hedblad
  • 83,499
  • 23
  • 264
  • 266