Export (0) Print
Expand All
Expand Minimize
4 out of 4 rated this helpful - Rate this topic

CommandBehavior Enumeration

Provides a description of the results of the query and its effect on the database.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

[Visual Basic]
<Flags>
<Serializable>
Public Enum CommandBehavior
[C#]
[Flags]
[Serializable]
public enum CommandBehavior
[C++]
[Flags]
[Serializable]
__value public enum CommandBehavior
[JScript]
public
   Flags
 Serializable
enum CommandBehavior

Remarks

The CommandBehavior values are used by the ExecuteReader method of IDbCommand and any classes derived from it.

A bitwise combination of these values may be used.

Members

Member name Description Value
CloseConnection

Supported by the .NET Compact Framework.

When the command is executed, the associated Connection object is closed when the associated DataReader object is closed. 32
Default

Supported by the .NET Compact Framework.

The query may return multiple result sets. Execution of the query may effect the database state. Default sets no CommandBehavior flags, so calling ExecuteReader(CommandBehavior.Default) is functionally equivalent to calling ExecuteReader(). 0
KeyInfo

Supported by the .NET Compact Framework.

The query returns column and primary key information. The query is executed without any locking on the selected rows.
Note   When using KeyInfo, the .NET Framework Data Provider for SQL Server appends a FOR BROWSE clause to the statement being executed. The user should be aware of potential side effects, such as interference with the use of SET FMTONLY ON statements. See SQL Server Books Online for more information.
4
SchemaOnly

Supported by the .NET Compact Framework.

The query returns column information only and does not effect the database state. 2
SequentialAccess

Supported by the .NET Compact Framework.

Provides a way for the DataReader to handle rows that contain columns with large binary values. Rather than loading the entire row, SequentialAccess enables the DataReader to load data as a stream. You can then use the GetBytes or GetChars method to specify a byte location to start the read operation, and a limited buffer size for the data being returned.

When you specify SequentialAccess, you are required to read from the columns in the order they are returned, although you are not required to read each column. Once you have read past a location in the returned stream of data, data at or before that location can no longer be read from the DataReader. When using the OleDbDataReader, you can reread the current column value until reading past it. When using the SqlDataReader, you can read a column value can only once.

16
SingleResult

Supported by the .NET Compact Framework.

The query returns a single result set. 1
SingleRow

Supported by the .NET Compact Framework.

The query is expected to return a single row. Execution of the query may effect the database state. Some .NET Framework data providers may, but are not required to, use this information to optimize the performance of the command. When you specify SingleRow with the ExecuteReader method of the OleDbCommand object, the .NET Framework Data Provider for OLE DB performs binding using the OLE DB IRow interface if it is available. Otherwise, it uses the IRowset interface. If your SQL statement is expected to return only a single row, specifying SingleRow can also improve application performance.

It is possible to specify SingleRow when executing queries that return multiple result sets. In that case, multiple result sets are still returned, but each result set has a single row.

8

Requirements

Namespace: System.Data

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System.Data (in System.Data.dll)

See Also

System.Data Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.