![]() ![]() | ||
The SqlCommand class represents an SQL statement or stored procedure for use in a database using SQL Server. Here is the inheritance hierarchy of this class:
Object MarshalByRefObject Component SqlCommand
You can find the more notable public properties of SqlCommand objects in Table 22.9 and their more notable methods in Table 22.10. (This class has no noninherited events.)
Property |
Means |
---|---|
CommandText |
Gets/sets the SQL statement (or stored procedure) for this command to execute. |
CommandTimeout |
Gets the amount of time to wait trying to execute a command. |
CommandType |
Gets/sets the type of the CommandText property (typically set to text for SQL). |
Connection |
Gets/sets the SqlConnection to use. |
DesignTimeVisible |
Gets/sets if the command object should be visible in a form designer. |
Parameters |
Gets the command parameters. |
Transaction |
Gets/sets the transaction that contains the command. |
UpdatedRowSource |
Gets/sets how results are used in a data row when you use the Update method. |
Method |
Means |
---|---|
Cancel |
Cancels a command's execution. |
CreateParameter |
Creates a new parameter. |
ExecuteNonQuery |
Executes a non-row returning SQL statement, returning the number of affected rows. |
ExecuteReader |
Creates a data reader using the command. |
ExecuteScalar |
Executes the command and returns the value in the first column in the first row of the result. |
ExecuteXmlReader |
Builds an XmlReader object. |
Prepare |
Creates a compiled version of the command. |
ResetCommandTimeout |
Resets the timeout value to the default value. |
![]() ![]() | ||