Simon Cripps
asked on
Last record in datarow
Hi is there any way I can identify the last DataRow in a table.
What I would like to do is list some items seperated by a comma apart from the last item.
such as:
For Each grandchildRow As DataRow In childRow.GetChildRows("Gra ndChildren ")
If not last row
CategoryLabel.Text = (grandchildRow("DCategory" ).ToString ()) + ", "
else if last row
CategoryLabel.Text = (grandchildRow("DCategory" ).ToString ())
Next
But what do I put to identify the last row?
Cheers
What I would like to do is list some items seperated by a comma apart from the last item.
such as:
For Each grandchildRow As DataRow In childRow.GetChildRows("Gra
If not last row
CategoryLabel.Text = (grandchildRow("DCategory"
else if last row
CategoryLabel.Text = (grandchildRow("DCategory"
Next
But what do I put to identify the last row?
Cheers
same result:
Dim row As DataRow = table.Rows(table.Rows.Coun t - 1) 'Where Table Your Table Name
Console.WriteLine(row("Col umnName"))
Dim row As DataRow = table.Rows(table.Rows.Coun
Console.WriteLine(row("Col
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
All good suggestions, the last one worked best for me.
Cheers
Cheers
datatable.rows(datatable.r