Data Access Overview For Smart Device Extensions

In this article we will take a brief look at Data Access for Smart Device Extensions. Smart Device Extension allows development for Pocket PC and Windows CE.Net platforms using the same Visual Studio.Net editor. It includes Compact Framework which is an abbreviated version of the .Net Framework suitable for device programming.
Data Access from SDE needs to be able to handle the differences of the mobile devices. It includes the System.Data.SqlClient namespace, which is slightly different from the System.Data.SqlClient namespace in the .Net Framework. Compact Framework does not support the OleDb namespace. Support for SQL Server CE is additionally included in SDE. SQL Server CE adds SQL Server support for mobile devices and supports connections to SQL Server 7 databases and above.

Important functionality provided by SQL Server CE classes

  1. Create and delete SQL Server CE databases on devices.
  2. Query Data
  3. Update Data and use transactions
  4. Remote Data Access
    Allows you to "pull" data from the remote device, and save it on the local database on the mobile device and vice versa using Remote Data Access (RDA). RDA is well-suited for simple data access

  5. Replication
    You can also use Replication to replicate data between a mobile device and SQL Server database on a remote server. Replication is more complex and also more configurable. It allows two-way data transfer. If you need a two-way merge of data between the server and the mobile device, Replication is the preferred solution. Replication is supported for SQL Server 2000 and above.

Important Classes and Namespaces

  1. Namespace System.Data.SqlClient
  2. Namespace System.Data.SqlServerCE
  3. Class SqlCeConnection : Represents a Connection to the data source
  4. Class SqlCeCommand: Class used to execute SQL Statements
  5. Class SqlCeDataAdapter : Encapsulates synchronization between a DataSet and a data source. Contains commands to fetch and update data and points to a connection.
  6. Class SqlCeParameter: Parameter to Commands.
  7. Class SqlCeDataReader: Provides forward-only access to data rows
  8. Class SqlCeException, SqlCeError: Represent Error/Exception that occurs in the data source
  9. Class SqlCeTransaction: Represents a Transaction
  10. Class RemoteDataAccess: Implements RDA
  11. Class Replication: Implements Replication
You can see the similarity between the classes in the SQLCE and the SQLClient namespace. In my next article, we will create a data access example for SDE using C#.


In this example we saw the various data access functionality and features available in SDE and Compact Framework. We also saw the important namespaces and classes for data access in Compact Framework. In conclusion, we can say that in spite of the different models and resources available on devices and desktop applications, .Net provides a common programming model for mobile devices through SDE and Compact Framework.
This article should not be construed as a best practices white paper. This article is entirely original, unless specified. Any resemblance to other material is an un-intentional coincidence and should not be misconstrued as malicious, slanderous, or any anything else hereof.

Similar Articles