Data Access Overview (Managed Device Projects)
The Visual Studio integrated development environment (IDE) for developing device projects that work with data resembles the environment for developing desktop data applications. Managed data applications for devices rely on ADO.NET namespaces supported by the .NET Compact Framework. This combination lends itself to applications where the data store on the device is typically disconnected from data on a server and is only periodically synchronized.
This topic covers the following information:
Types of external data
Connecting to data
Accessing data in device applications.
Since the .NET Compact Framework implements ADO.NET, device applications can connect to numerous external data sources, such as the following:
SQL Server Compact 3.5
SQL Server Mobile Edition
For more information, see Data Access and XML Support in the .NET Compact Framework.
Device developers often use SQL Server Compact 3.5 in device applications because most mobile devices cannot maintain a reliable network connection.
With SQL Server Compact 3.5, the device application continues to function when the device is disconnected because the data is store locally on the device as a database file (.sdf). When a network connection is found, the application can synchronize with the remote SQL Server database. For more information, see Using SQL Server Compact 3.5 Databases (Devices).
In order to access external data in your device application, you must create a data source in your device project. A data source is an object in your device application that represents the external data. The data source knows how to connect to, retrieve, and update external data in a database or a Web service. The data source also exposes the data to device applications through DataSet or System.Data.SqlServerCe.SqlCeResultSet objects. For more information, see Data Sources Overview and Connecting to Data in Visual Studio Overview.
Visual Studio provides tools to automatically generate data sources and manage connection strings. For more information, see:
If the data source exposes data through a DataSet object, your device application can directly access data in a DataSet by accessing the DataTable and DataRow objects in the DataSet . Also, you can bind user interface (UI) controls such as DataGrid, ListBox, and ComboBox to data in a DataSet .
Some data sources do not expose data through DataSet objects. A data source that connects to a SQL Server Compact 3.5 database can expose a System.Data.SqlServerCe.SqlCeResultSet instead. For more information, see Using SQL Server Compact 3.5 Databases (Devices).
By default, SQL Server Compact 3.5 documentation is not installed locally. To download SQL Server Compact 3.5 Books Online, go to the SQL Server Compact 3.5 Books Online Download Center.