Reputation: 7092
I have a database command that populates a DataTable I want to get the value of an entry in the Datatable, based on, A: The numeral index of the row, and b, the string name of the column. That's all I want, how is that possible?
Upvotes: 1
Views: 128
Reputation: 19881
DataTable dt = GetData();
var result = dt.Rows[RowIndex]["MyColumnName"];
The RowIndex
is an indexed property of the datatable which returns a DataRow
. "MyColumnName" is an indexed property of the DataRow, returning the value as an object.
Upvotes: 0