Tableadapter record count

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am using the below statement;

Me.MyTableAdapter.Fill(Me.MyDataSet.tblMyTable)

How can I now check the record count of the data table and specifically if
the record count returned by fill is not 0?

Thanks

Regards
 
Really, is that your question?

With MSDN installed
1. Dim x as System.Data.SQLCLient.SQLDataAdapter
2. Highlight SQLDataAdapter
3. Press F1

Without MSDN installed
1. Open your favorite browser
2. Navigate to msdn.microsoft.com
3. Search on SQLDataAdapter Class


Some more help.

Intellisense shows Me.MyTableAdapter.Fill has several signatures, and that
it returns an integer. I wonder what that integer is for?

After filling Me.MyDataSet.tblMyTable, there should be a collection of rows
(0-N). Me.MyDataSet.tblMyTable.Rows.Count will either equal 0 or N. If the
table already had rows then:

dim iRowCount as integer = Me.MyDataSet.tblMyTable.Rows.Count
dim iSomeInteger as integer =
Me.MyTableAdapter.Fill(Me.MyDataSet.tblMyTable)
dim iNewRowCount as integer = Me.MyDataSet.tblMyTable.Rows.Count

msgbox iNewRowCount - iRowCount & " rows have changed" & vbcrlf & "With a
return value of " & iSomeInteger & vbcrlf & "Which means " & iSomeInteger -
(iNewRowCount - iRowCount) & " rows were simply refreshed."


http://msdn2.microsoft.com/en-us/library/905keexk(VS.80).aspx

Snip ...
Return Value
The number of rows successfully added to or refreshed in the DataSet. This
does not include rows affected by statements that do not return rows.
.... Snip
 
Back
Top