Using Default Result Sets

ADO and SQL Server

ADO and SQL Server

Using Default Result Sets

By default, an ADO application does not use Microsoft® SQL Server™ 2000 API server cursors with SQLOLEDB. The default cursor used by the ADO application is read-only and forward-only, and uses default result set processing.

Default result sets support all of the Transact-SQL statements. There are no restrictions on the types of SQL statements that can be executed when using a default result set. However, server cursors do not support all Transact-SQL statements. For example, server cursors do not support any SQL statement that generates multiple result sets.

The following types of statements are not supported by server cursors:

  • Batches. These are SQL statements built from two or more individual SQL SELECT statements. For example:

SELECT * FROM authors; SELECT * FROM titles

  • Stored procedures with multiple SELECT statements. These are SQL statements that execute a stored procedure containing more than one SELECT statement. This includes SELECT statements that fill parameters or variables.

  • Keywords These are SQL statements containing the keywords COMPUTE, COMPUTE BY, FOR BROWSE, or INTO.

In SQL Server 2000, if an SQL statement that matches any of these types is executed with a server cursor, the server cursor is implicitly converted to a default result set. An application can call the Supports method of the Recordset object to verify the specific functionality of the cursor setting. For more information, see Implicit Cursor Conversions.

SQL statements that do not fit the types listed earlier can be executed with any statement settings; they work equally well with either a default result set or a server cursor.