Share via

System.Data.SqlServerCe Namespace

The System.Data.SqlServerCe namespace is the managed data provider for SQL Server Compact 4.0. This namespace is a collection of classes that provide access to SQL Server Compact 4.0 databases. By using System.Data.SqlServerCe, you can create and manage SQL Server Compact 4.0 databases from a computer. 

The following features are available for creating SQL Server Compact 4.0 desktop and Web applications.

  • Support for the TransactionScope class.

  • SQL Server Compact 4.0 provider for the ADO.NET Entity Framework (System.Data.SqlServerCe.Entity.dll).

  • Support for Visual C# and Visual Basic application development in Visual Studio 2010 SP1.

  • Support for working in Medium (Partial) Trust environment.

  • The flag SQLServerCompactEditionUnderWebHosting was required to be set, to use SQL Server Compact in ASP.NET Web applications. The flag is removed and SQL Server Compact 4.0 can be used easily as an embedded database in Web applications.


  Class Description
Public class ResultSetEnumerator An enumerator that can be used to iterate through a collection of records in a ResultSet object. The ResultSetEnumerator is not designed to be used directly from within your code. You will get more functionality by working directly with the SqlCeResultSet object.
Public class ResultSetView Implements data binding interfaces and provides a bridge between user interface controls and the SqlCeResultSet.
Public class RowView Infrastructure.
Public class SqlCeChangeTracking Provides methods that can be used to track changes to tables in a SQL Server Compact database.
Public class SqlCeCommand Represents an SQL statement to execute against a data source.
Public class SqlCeCommandBuilder Provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated database. This class cannot be inherited.
Public class SqlCeConnection Represents an open connection to a SQL Server Compact data source.
Public class SqlCeConnectionStringBuilder Provides a simple way to create and manage the contents of connection strings used by the SqlCeConnection class.
Public class SqlCeDataAdapter Represents a set of data commands and a database connection that are used to fill the DataSet and update the data source.
Public class SqlCeDataReader Provides a way of reading a forward-only stream of data rows from a data source. This class cannot be inherited.
Public class SqlCeEngine Represents the properties, methods, and other objects of the SQL Server Compact Engine object. This class cannot be inherited.
Public class SqlCeError Collects information relevant to a warning or error returned by the data source. This class cannot be inherited.
Public class SqlCeErrorCollection Collects all errors generated by the .NET Compact Framework Data Provider for SQL Server Compact. This class cannot be inherited.
Public class SqlCeException The exception thrown when the underlying provider returns a warning or error from a SQL Server Compact data source. This class cannot be inherited.
Public class SqlCeFlushFailureEventArgs Encapsulates event arguments for the FlushFailure event.
Public class SqlCeInfoMessageEventArgs Provides data for the InfoMessage event. This class cannot be inherited.
Public class SqlCeInvalidDatabaseFormatException The exception thrown when the underlying provider returns an error from a Microsoft SQL Server Compact data source when SQL Server Compact attempts to open a database file of an older or newer version.
Public class SqlCeLockTimeoutException This exception is thrown if the lock timeout has been reached.
Public class SqlCeParameter Represents a parameter to a SqlCeCommand and, optionally, its mapping to a DataSet column. This class cannot be inherited.
Public class SqlCeParameterCollection Collects all parameters relevant to a SqlCeCommand as well as their respective mappings to DataSet columns.
Public class SqlCeProviderFactory Represents a set of methods for creating instances of a provider's implementation of the data source classes.
Public class SqlCeRemoteDataAccess Initializes a new instance of the SqlCeRemoteDataAccess object. For more information about Remote Data Access, see Using Remote Data Access (RDA).
Public class SqlCeReplication Initializes a new instance of the SqlCeReplication object. For more information about SQL Server replication, see the SQL Server Books Online. For more information about merge replication with SQL Server Compact, see the SQL Server Compact Books Online.
Public class SqlCeResultSet An updateable, scrollable, and bindable cursor.
Public class SqlCeRowUpdatedEventArgs Provides data for the RowUpdated event.
Public class SqlCeRowUpdatingEventArgs Provides data for the RowUpdating event.
Public class SqlCeTransaction Represents an SQL transaction to be made at a data source. This class cannot be inherited.
Public class SqlCeTransactionInProgressException The exception thrown when the underlying provider returns an error from a Microsoft SQL Server Compact data source when an operation is attempted while a transaction is in progress.
Public class SqlCeType Infrastructure.
Public class SqlCeUpdatableRecord Represents a row of updatable values from the data source. A SqlCeResultSet object contains one or more UpdatableRecords.
Public class SqlMetaData Infrastructure. Specifies and retrieves metadata information from parameters and columns retrieved from a database. This class cannot be inherited.


  Delegate Description
Public delegate OnStartTableDownload A user-defined delegate to the event that fires at the start of downloading table changes from the server.
Public delegate OnStartTableUpload A user-defined delegate to the event that fires at the start of uploading table changes to the server.
Public delegate OnSynchronization A user-defined delegate that consumes the ongoing synchronization events reported during the reconciler work.
Public delegate SqlCeFlushFailureEventHandler The delegate that must be implemented to listen for FlushFailure events.
Public delegate SqlCeInfoMessageEventHandler Represents the method that will handle the InfoMessage event of a SqlCeConnection.
Public delegate SqlCeRowUpdatedEventHandler Represents the method that will handle the RowUpdated event of a SqlCeDataAdapter.
Public delegate SqlCeRowUpdatingEventHandler Represents the method that handles the RowUpdating event of a SqlCeDataAdapter.


  Enumeration Description
Public enumeration AddOption Determines whether the subscription will be added to an existing database or whether a new database will be created when the subscription is added.
Public enumeration CommitMode When passed to the Commit function, the CommitMode specifies when the commit occurs.
Public enumeration DbInsertOptions Specifies the options to use when using the [System.Data.SqlServerCe.SqlCeResultSet.Insert] method.
Public enumeration DbRangeOptions Specifies the options used by the SetRange method when specifying the index range over which to seek.
Public enumeration DbSeekOptions Options that specify how the Seek method will seek on an index.
Public enumeration DropOption Specifies whether to leave or delete the database when dropping a subscription using the DropSubscription method.
Public enumeration ExchangeType Specifies whether data is merged up to the Publisher only, or merge in both directions between the Publisher and the Subscriber.
Public enumeration NetworkType Specifies the network protocol to use when setting the DistributorNetwork or PublisherNetwork properties of the SqlCeReplication object.
Public enumeration PurgeType Specifies the criteria to use to purge metadata when using the PurgeTombstoneTableData method or the PurgeTransactionSequenceData method of the SqlCeChangeTracking class.
Public enumeration RdaBatchOption Specifies whether or not the rows associated with the Push should be batched together in a single transaction.
Public enumeration RdaTrackOption Specifies whether or not the table being pulled to the device is tracked.
Public enumeration RepairOption When passed to the Repair method, RepairOption specifies the type of database repair to perform.
Public enumeration ResultSetOptions Sets options for the ResultSetEnumerator.
Public enumeration ResultSetSensitivity Sets the sensitivity of the ResultSetEnumerator.
Public enumeration SecurityType Specifies the mode of security to use when connecting to the Publisher or Distributor during Replication.
Public enumeration SnapshotTransferType Controls how snapshot files are transferred from the Distributor to the computer running IIS.
Public enumeration TrackingKeyType Specifies the type of key used to identify tracking data.
Public enumeration TrackingOptions Specifies which operations on a table are tracked.
Public enumeration ValidateType Specifies the type of data validation to perform.
Public enumeration VerifyOption These options determine the level of database verification to use.