How to get the row number from a datatable?

前端 未结 7 1425
谎友^
谎友^ 2020-12-08 06:18

I am looping through every row in a datatable:

foreach (DataRow row in dt.Rows) {}

I would like to get the index of the current row within

相关标签:
7条回答
  • 2020-12-08 07:10

    Try:

    int i = Convert.ToInt32(dt.Rows.Count);
    

    I think it's the shortest, thus the simplest way.

    0 讨论(0)
提交回复
热议问题