Initializes a new instance of the SQLCommand class with the given command text and a connection string.
[Visual Basic] Overloads Public Sub New( _ ByVal cmdText As String, _ ByVal connectionString As String _ ) [C#] public SQLCommand( string cmdText, string connectionString ); [C++] public: SQLCommand( String* cmdText, String* connectionString ); [JScript] public function SQLCommand( cmdText : String, connectionString : String );
When an instance of SQLCommand is created, the following read/write properties are set to initial values.
Properties | Initial Value |
---|---|
CommandText | cmdText |
CommandTimeout | 30 |
CommandType | CommandType.Text |
ActiveConnection | A new SQLConnection created using connectionString. |
CommandBehavior | 0 |
You can change the value for any of these properties through a separate call to the property.
The following example creates a SQLCommand and sets some of its properties.
SQLCommand Class | SQLCommand Members | System.Data.SQL Namespace | SQLCommand Constructor Overload List