.NET - How do I retrieve specific items out of a Dataset?

后端 未结 5 2028
天命终不由人
天命终不由人 2021-02-07 18:50

I have the following code which connects to a database and stores the data into a dataset.

What I need to do now is get a single value from the data set (well actually i

5条回答
  •  你的背包
    2021-02-07 19:36

    I prefer to use something like this:

    int? var1 = ds.Tables[0].Rows[0].Field("ColumnName");
    

    or

    int? var1 = ds.Tables[0].Rows[0].Field(3);   //column index
    

提交回复
热议问题