I've pulled a dataset into a datagrid and now I need the max(id) of the dataset. I've sorted them ascending so I know that the highest id will be the last one but I'm having trouble getting an individual field value like we did in VB6 with ado recordsets:
rs.fields("fieldname")
This is what I have in my web service so far:
Dim adpt As New SqlClient.SqlDataAdapter(strSQL, con)
Dim ds As New DataSet()
Dim combinedTable As DataTable = ds.Tables.Add("CombinedTable")
con.Open()
adpt.Fill(ds, "Combined")
intRowCount = combinedTable.Rows.Count()
intMaxID = combinedTable.Rows(intRowCount).Item(0)
con.Close()
Return ds
What I'm doing is trying to get the row count and then use that count as the row reference. I keep coming up with zero although I am returning 100 records. Any help would be appreciated.


Reply With Quote