I've been fooling around with execution of SQL Statement Batches using ADO.NET, using both the SqlClient and OleDb.NET client this week. In doing so, I ran into a slightlt misleading statement in the documentation for OleDbDataReader::RecordsAffected property. It says:

"The RecordsAffected property is not set until all rows are read and you close the OleDbDataReader."

This isn't exactly true. As I found out, it is indeed set incrementaly as you iterate through the returned result sets (using OleDbDataReader::NextResult()). So, what happens is that you can read it midway and get partial information, or wait until you've gotten as far as the last result set returned or the reader is closed. Either way, it's not exactly as the documentation states, which can be confusing (or even dangerous, for all I know).

Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.