DataRow: Select cell value by a given column name

后端 未结 8 1527
小鲜肉
小鲜肉 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:30

    You can get the column value in VB.net

    Dim row As DataRow = fooTable.Rows(0)
    Dim temp = Convert.ToString(row("ColumnName"))
    

    And in C# you can use Jimmy's Answer, just be careful while converting it to ToString(). It can throw null exception if the data is null instead Use Convert.ToString(your_expression) to avoid null exception reference

提交回复
热议问题