DataTable.Rows(RowNumber)
'Or
Dim dr() As DataRow = DataTable.Select("AColumn = 'abc'")
The second allows you to find a row that has a column or columns containing data you want to find...
Say for example, you have a table with peoples firstnames, surnames, age...
You could use the following:
Code:
'FirstName
Dim dr() As DataRow = DataTable.Select("FirstName = 'Bob'")
'FirstName and surname
Dim dr() As DataRow = DataTable.Select(FistName = 'Bob' AND Surname = 'Smith')
'Age equal or above 30
Dim dr() As DataRow = DataTable.Select("Age >= 30")
If you are just after one record then use code to see if the dr() has items 'If dr.Length > 0 Then' and use dr(0) to access the first record returned.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.