record count after .fill()

HeavenCore

Well-known member
Joined
Apr 10, 2007
Messages
77
Location
Bolton, England
Programming Experience
1-3
hi i have various tableadapter .fill() methods, .fillByClientID() for example selects all records where client id = a search value

this works; however how do i determine how many rows where selected?

Cheers
 
you got it in one :D

It's a good way of putting some validation in on your form as well.

i.e.

VB.NET:
dim varSurname as string = "Smith" 'this is an example!

me.tableadapter.fillbysurname(me.dataset, varSurname)

If me.dataset.datatable.rows.count = 0 Then
  messagebox.show ("Sorry, no rows for employees with the surname " & varSurname)
Else
 ....
 ....
End If
 
Bear in mind that whether or not a recordset is cleared first, depends on the ClearBeforeFill of the tableadapter... Hence a fill might result in 0 new records being added, but if CLearBeforeFill was false, the table will still contain data not added by this fill. Its unlikely to be of significance in the majority of situations..
 
Back
Top