June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to read a large binary field without loading the entire row into memory at once.
Use the CommandBehavior.SequentialAccess option with the DataReader to use stream-based access to binary data.
By default, the DataReader loads an entire row into memory every time you call the Read method. This approach is dangerously inefficient if your database records include extremely large fields—for example, binary data that might be tens of megabytes in size.
In this case, a better approach is to read the data in smaller blocks. This approach allows you to perform other processing as you read the data. For example, you might want to copy the data to the hard drive 1 KB at ...
Read now
Unlock full access