Share via


SqlCeCommand Constructor (String)

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

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

Syntax

'Declaration
Public Sub New ( _
    commandText As String _
)
'Usage
Dim commandText As String

Dim instance As New SqlCeCommand(commandText)
public SqlCeCommand(
    string commandText
)
public:
SqlCeCommand(
    String^ commandText
)
new : 
        commandText:string -> SqlCeCommand
public function SqlCeCommand(
    commandText : String
)

Parameters

Remarks

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

Properties

Initial Value

CommandText

cmdText

CommandType

Text

Connection

null

Examples

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

Dim queryText As String = "SELECT * FROM Categories ORDER BY [Category ID]"
Dim cmd As New SqlCeCommand(queryText)

cmd.Connection = conn
cmd.CommandType = CommandType.Text
string queryText = "SELECT * FROM Categories ORDER BY [Category ID]";
SqlCeCommand cmd = new SqlCeCommand(queryText);

cmd.Connection = conn;
cmd.CommandType = CommandType.Text;

See Also

Reference

SqlCeCommand Class

SqlCeCommand Members

SqlCeCommand Overload

System.Data.SqlServerCe Namespace