ARTICLE

Data Access Overview for Smart Device Extensions

Posted by Dipal Choksi Articles | ADO.NET in C# December 23, 2002
In this article we will take a brief look at ata Access for Smart Device Extensions.
Reader Level:

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#.

Conclusion

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.

Login to add your contents and source code to this article
post comment
     

What you mention above is exactly what I'm looking for and having no luck finding.  Is there another article I should be finding which would expand on how to modify data on a Smart Device which will be Replicated to a SQL Server?  Thank you!

Posted by Becky Finley May 26, 2010

hello 

i am making my project in this smart devices application.
in this i have to insert data through this application into the database which is present in the server. 

so how can i insert data in from this smart device  remotely??

please let know asap... ??

Aditya 

Posted by aditya chavan Apr 26, 2010
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts