I have a dataset column which is "newsID". I want to get the value of it's last record so that I can use it as a default value or starting point to auto increment when I add a new record using the BindingNavigator.
Thank you for your help!!!:)
I have a dataset column which is "newsID". I want to get the value of it's last record so that I can use it as a default value or starting point to auto increment when I add a new record using the BindingNavigator.
Thank you for your help!!!:)
If newsID is an integer you could do this with the Compute method:
Dim iLastNewsID As Integer = ds.Tables(0).Compute("Max(newsID)", Nothing)
Or if the order is reliable already and you simply want the last row in the DataSet then I don't see a problem with this:
Dim iLastNewsID As Integer = ds.Tables(0)(ds.Tables(0).Rows.Count - 1)("newsID")