Export (0) Print
Expand All

SqlCeCommand Constructor (String, SqlCeConnection)

Initializes a new instance of the SqlCeCommand class with the text of the query and a SqlCeConnection.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

public SqlCeCommand(
	string commandText,
	SqlCeConnection connection
)

Parameters

commandText
Type: System.String
The text of the query.
connection
Type: System.Data.SqlServerCe.SqlCeConnection
A SqlCeConnection that represents the connection to a data source.

The following table shows initial property values for an instance of SqlCeCommand.

Properties

Initial Value

CommandText

cmdText

CommandType

Text

Connection

A new SqlCeConnection that is the value for the connection parameter.

You can change the value for any of these parameters by setting the related property.

The following example creates a SqlCeCommand and sets some of its properties.

conn.Open();
SqlCeCommand cmd = new SqlCeCommand("INSERT INTO foo (col1) VALUES (1)", conn);
cmd.ExecuteNonQuery();
conn.Close();


Show:
© 2014 Microsoft