locked
client-side/server side cursor RRS feed

  • Question

  • I'm using VS.NET 2005 (July CTP) to develop a windows application that connects to a SQL Server database.  How can I set my connection to use server-side cursors instead of client-side?  I'm going to have some large result sets and I'm afraid some client machines will not have adequate disk space. 
    Tuesday, August 2, 2005 4:55 PM

Answers

  • .Net Data Provider for Sql Server (SqlClient) version 2.0 does not support server-side cursor. There is no connection string attribute to enable this.

    If you have certain large BLOB columns, then you can use ExecuteReader with the CommandBehavior.SequentialAccess option. The values will not be cached by the reader so this should help with the memory issues.

    If its a large number of records that you are going to get from your query but only want to read some of the results, even then the DataReader is a good solution because it doesn't cache the entire results of the query. It keeps reading packets off of the wire as you keep calling Reads.
    Monday, September 26, 2005 11:00 PM