[ Team LiB ] Previous Section Next Section

CommandBehavior serializable, flag

System.Data (system.data.dll) enum

This enumeration is used with an overload of the IDbCommand.ExecuteReader( ) method. Typically, you don't use this method directly but will instead use the IDbCommand.ExecuteReader( ) method that requires no arguments, which is functionally equivalent to calling IDbCommand.ExecuteReader( ) with Default . One notable exception is when you access BLOB information (a column that contains a binary large object). In this case, the SequentialAccess value is useful because it instructs .NET not to load the entire row into memory at once. Rather, the row is read as a stream, and you can use the IDataRecord.GetBytes( ) method (exposed by most DataReader objects) to specify a byte location to start the read operation and the number of bytes to read for the data returned. This technique is demonstrated in Chapter 5. You can also use other CommandBehavior enumeration values to specify the command to return a single value, a single row, column schema information, or column and primary key information.

public enum CommandBehavior {
   Default = 0x00000000,
   SingleResult = 0x00000001,
   SchemaOnly = 0x00000002,
   KeyInfo = 0x00000004,
   SingleRow = 0x00000008,
   SequentialAccess = 0x00000010,
   CloseConnection = 0x00000020
}
Figure 34-3. System.Data's components and miscellaneous types
figs/adonet_3403.gif

Hierarchy

System.Object figs/U2192.gif System.ValueType figs/U2192.gif System.Enum(System.IComparable, System.IFormattable , System.IConvertible) figs/U2192.gif CommandBehavior

Passed To

System.Data.Common.DbDataAdapter.{Fill( ) , FillSchema( )} , IDbCommand.ExecuteReader( ) , System.Data.OleDb.OleDbCommand.ExecuteReader( ) , System.Data.OracleClient.OracleCommand.ExecuteReader( ) , System.Data.SqlClient.SqlCommand.ExecuteReader( )

    [ Team LiB ] Previous Section Next Section