Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is different between SqlCommand object and Command
Behaviour Object

Answer Posted / kiranmadiraju

SqlCommand is used to store a SQL command/Name of the
stored procedure along with parameter collection to execute
against the datastore

Whereas CommandBehaviour provides the description of
results of the query and its effect on the database.

The values are like this
1.Default
The query may return multiple result sets. Execution of the
query may affect the database state. Default sets no
System.Data.CommandBehavior flags, so calling ExecuteReader
(CommandBehavior.Default) is functionally equivalent to
calling ExecuteReader().

2.SingleResult
The query returns a single result set.

3.SchemaOnly
The query returns column information only. When using
System.Data.CommandBehavior.SchemaOnly,the .NET Framework
Data Provider for SQL Server precedes the statement being
executed with SET FMTONLY ON.

4.KeyInfo
The query returns column and primary key information.

5.SingleRow
The query is expected to return a single row. Execution of
the query may affect 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
System.Data.CommandBehavior.SingleRow with the
System.Data.OleDb.OleDbCommand.ExecuteReader() method of
the System.Data.OleDb.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
System.Data.CommandBehavior.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.

6.SequentialAccess
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.
7.CloseConnection
When the command is executed, the associated
Connection object is closed
when the associated DataReader object is
closed.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are all the different methods under sqlcommand?

921


how we can fire event in databound coulm in datagfrid withot using button?

917


How to creating a SqlCommand Object?

1072


What are two important objects of ADO.Net?

970


What is the difference between Datareader and Dataset?

1028


Which database is the ado.net sql connection object designed for?

998


Which is the best method to get two values from the database?

921


What is the difference between connected and disconnected environment?

1009


What is the procedure to call a Stored Procedure of Back End in ADO (ActiveX Data Object) and RDO (Remote Data Objects)?

999


What provider ado.net use by default? Explain the role of data provider in ado.net? What is the role of data provider in ado.net?

923


How will you differentiate between ADO (ActiveX Data Object) and RDO (Remote Data Objects)?

970


Which is faster sqldataadapter and sqldatareader?

874


How many major types of connection objects in ADO.NET?

991


Define partial class?

903


What is variable view?

830