Represents an SQL statement to execute against a data source.
For a list of all members of this type, see SqlCeCommand Members.
[Visual Basic] NotInheritable Public Class SqlCeCommand Inherits MarshalByRefObject Implements ICloneable, IDbCommand, IDisposable [C#] public sealed class SqlCeCommand : MarshalByRefObject, ICloneable, IDbCommand, IDisposable [C++] public __gc __sealed class SqlCeCommand : public MarshalByRefObject, ICloneable, IDbCommand, IDisposable [JScript] public class SqlCeCommand extends MarshalByRefObject implements ICloneable, IDbCommand, IDisposable
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
When an instance of SqlCeCommand is created, the read/write properties are set to their initial values. For a list of these values, see the SqlCeCommand constructor.
SqlCeCommand features the following methods that execute commands at a data source:
|ExecuteReader||Executes commands that return rows.|
|ExecuteNonQuery||Executes SQL commands such as INSERT, DELETE, and UPDATE statements.|
|ExecuteScalar||Retrieves a single value (for example, an aggregate value) from a database.|
The .NET Compact Framework data provider for SQL Server CE does not support named parameters for passing parameters to an SQL statement called by a SqlCeCommand when CommandType is set to Text. You must use the question mark (?) placeholder. For example:
SELECT * FROM Customers WHERE CustomerID = ?
The data provider for SQL Server CE also does not support batched queries. Commands must be in the form of Select * from Customers and not Select * from Customers; Select *
from Orders;. If you are using code generated for System.Data.SqlClient, you may have to alter your queries to conform to this restriction.
Although SQL Server CE only supports one connection at a time, multiple commands can share the same connection. This means that it is possible to have multiple instances of SqlCeDataReader on the same connection. This behavior differs from that of System.Data.SqlClient.
Platforms: .NET Compact Framework
Assembly: System.Data.Sqlserverce (in System.Data.Sqlserverce.dll)