DataRow: Select cell value by a given column name

后端 未结 8 1548
小鲜肉
小鲜肉 2020-12-15 15:19

I have a problem with a DataRow that I\'m really struggling with.

The datarow is read in from an Excel spreadsheet using an OleDbConnection.

If I try to sele

8条回答
  •  渐次进展
    2020-12-15 15:46

    This must be a new feature or something, otherwise I'm not sure why it hasn't been mentioned.

    You can access the value in a column in a DataRow object using row["ColumnName"]:

    DataRow row = table.Rows[0];
    string rowValue = row["ColumnName"].ToString();
    

提交回复
热议问题