Out of memory exceptions are usually down to recursion - are you running a loop to process? Perhaps you're not incrementing a loop counter and it's processing the first record over and over...
C# has already designed away most of the tedium of C++.
How many rows are you trying to bind to the Grid ? Make sure you select only the columns necessary and build filtering logic in so that you are not attempting to display thousands of rows to a grid.
Glad to help
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman