有没有办法确定从DataTable中收集一组数据的行?
我目前有这段代码
expression = "date = '" & numericYear & "-" & doubleMonth & "-20'"
foundRows = dbTable.Select(expression)
For count = 0 To foundRows.Length - 1
tableRow =
MessageBox.Show(dbTable.Rows(count).Item(5).ToString())
Next count
问题是消息框显示第0行然后是1然后是2等。如何让它显示从数据表中读取的行?例如,如果正在读取的事件在数据表的第52行,我该怎么说呢?
答案 0 :(得分:0)
您可以使用indexof
方法:
foundRows = dbTable.Select(expression)
For count = 0 To foundRows.Length - 1
rowIndex = dbTable.Rows.IndexOf(foundRows(count))
MessageBox.Show("Row " & cstr(rowIndex) & " " & foundRows(count).Item(5).ToString())
Next count