asp.net.ph

SqlCommand Constructor ( )

System.Data.SqlClient Namespace   SqlCommand Class


Initializes a new instance of the SqlCommand class.

[ VB ]
Public Sub New ( )

[ C# ]
public SqlCommand ( );

[ C++ ]
public: SqlCommand ( );

[ JScript ]
public function SqlCommand ( );

Remarks

The base constructor initializes all fields to their default values. The following table shows initial property values for an instance of SqlCommand created with this constructor.

Properties Initial Value
CommandText empty string ( "" )
CommandTimeout 30
CommandType CommandType.Text
Connection null

You can change the value for any of these properties through a separate call to the property.

Example

The following example initializes an SqlCommand using this constructor and sets some of its properties.

void setSqlCommand ( ) {
   SqlCommand myCommand = new SqlCommand ( );
   myCommand.CommandTimeout = 15;
   myCommand.CommandType = CommandType.Text;
}
  C# VB

See Also

SqlCommand Members   SqlCommand Constructor Overload List Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph