Data Access Overview for Smart Device Extensions
In this article we will take a brief look at ata Access 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 :
- Create and delete SQL Server CE databases on devices.
- Query Data
- Update Data and use transactions
- 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
- 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
- Namespace System.Data.SqlClient
- Namespace System.Data.SqlServerCE
- Class SqlCeConnection : Represents a Connection to the data source
- Class SqlCeCommand: Class used to execute SQL Statements
- Class SqlCeDataAdapter : Encapsulates synchronization between a DataSet and a data source. Contains commands to fetch and update data and points to a connection.
- Class SqlCeParameter: Parameter to Commands.
- Class SqlCeDataReader: Provides forward-only access to data rows
- Class SqlCeException, SqlCeError: Represent Error/Exception that occurs in the data source
- Class SqlCeTransaction: Represents a Transaction
- Class RemoteDataAccess: Implements RDA
- 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.
NOTE: 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.