|
A SqlCeDataReader object may read data from the database in one of two modes:
- Bulk - In bulk mode all rows are read on the device and buffered in the Pipe's internal queue. This mode offers the best possible performance because it avoids handshaking between the two endpoints. This mode's drawback is that it requires that all rows be read until SqlCeDataReader.Read returns false. Failure to comply with this will cause application errors in the form of Pipe exceptions.
- Row - In this mode the SqlCeDataReader reads one row at a time and can be closed or disposed of at any time. It is slower than bulk mode because each Read operation must be transmitted to the device as a sequence of "Move Next" and "Get Row Data" operations. So, for each row, there is more bidirectional traffic on the Pipe making the rewading process much slower.
So how do you decide which mode is best for you? Use Bulk mode when the following are true:
- You want the very best performance;
- You will read all the returned data.
Use the Row mode when:
- Performance is not an issue;
- You want to read only parts of the data.
|