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)

Syntax

'Declaration
Public Sub New ( _
    commandText As String, _
    connection As SqlCeConnection _
)
public SqlCeCommand (
    string commandText,
    SqlCeConnection connection
)
public:
SqlCeCommand (
    String^ commandText, 
    SqlCeConnection^ connection
)
public SqlCeCommand (
    String commandText, 
    SqlCeConnection connection
)
public function SqlCeCommand (
    commandText : String, 
    connection : SqlCeConnection
)

Parameters

  • commandText
    The text of the query.
  • connection
    A SqlCeConnection that represents the connection to a data source.

Remarks

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.

Example

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

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

Platforms

Development Platforms

Windows Vista, Windows Mobile 5.0, Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Mobile 2003 for Pocket PC, Windows CE 5.0
Version Information
.NET Framework and NET Compact Framework
Supported in 3.5
.NET Framework
Supported in 3.0
.NET Compact Framework and .Net Framework
Supported in 2.0

See Also

Reference

SqlCeCommand Class
SqlCeCommand Members
System.Data.SqlServerCe Namespace