Introduction Programming SQL Server Compact Edition as a High-Performance Local Data Store Creating a SQL Server Compact Edition Database Creating the Test Application Coding Record Insertion Logic Using Sql Ce Result Set to Query Data from SQL Server Compact Edition Forms Design and Data Components Comparing Data Set and Sql Ce Result Set to Retrieve from Joined Tables Using Set Range to Filter Records from a Single Table by Using an Index Updating Records by Using Sql Ce Result Set Conclusion Microsoft SQL Server Compact Edition is a small memory footprint, efficient database application, ideal for use as a local data store for applications on mobile devices and portable computers.
SQL Server Compact Edition follows the pattern of the .
The first query uses a Data Set approach, joining the Order Details table to the Product Details and displaying the results.
The query joins the tables on a common column that in this case is the Product ID column.
When it reads from a single table by using Table Direct, the query processor is bypassed. In this case selection can be done on a table index by using the Set Range property for the data selection.
In the demo application, retrieving from a single table with selection is compared by using Sql Ce Result Set with Set Range, Sql Ce Result Set and Data Set.
The code then uses a Sql Ce Result Set object to read the records from the database and to bind them to the Binding Source for display.First a new Stop Watch object is started and 1000 records are inserted into the table.The records are then read out of the table again and used to populate the grid.Finally, each approach displays the elapsed time for the operation as recorded by the Stop Watch object.The following code example shows how to use the Data Set approach to insert the records.Use a Sql Ce Command object that has its Command Type property set to Command Type.Table Direct, setting the Index Name property to the name of the index that you want to use, and setting the Set Range property to the range of values that you want to retrieve.This article compares record insertion and retrieval techniques when you use Microsoft® SQL Server® Compact Edition 3.5 SP1 as a local data store in mobile device applications, with particular focus on the use of the Sql Ce Result Set object.The sample projects show how to insert, update, and retrieve records from sample databases.With a Sql Ce Result Set object, you are working directly against the data that is stored in the database, and you avoid the overhead of reading out of the database, only to cache it in memory in a Data Set object before working with it in your application.The Sql Ce Result Set object makes much more sense on memory-constrained devices.