Wouldn't that number have to be unique, though? If so, you don't so much want the count as you want the Max value. After all, if you are using the count N, and you end up deleting a record from the middle of the table, the count will be N-1, but N will already be used for a record, so the count would no longer do you any good. Using Max+1 would be ideal.
There may be an easier way to get the max, but this should work:
Code:
Dim max = (from m in Dataset.Tables("Members") Select DirectCast(m,Datarow).Item("MemberID")).Max
Alternatively, you could do something like this:
Code:
If Dataset.Tables("Members").Select("MemberID = '" & txtMemberID.Text & "'").FirstOrDefault IsNothing Then
'Whatever was entered is not in the dataset.
Else
'Whatever was entered IS in the dataset
End If
Still, one thing concerns me about what you said: You stated that the count didn't change when you added a row. That's not right. I'd investigate that further. It suggests that you are not adding the new row to the dataset, which would mean that either of the previous methods will fail.