You can also set the Set Range property to retrieve a subset of records from a table by filtering on a range of values of a named index from the table.The following example fetches records from the Products table fetching only those records with a Product ID between 30 and 40.
The query joins the tables on a common column that in this case is the Product ID column.The following screen shows the output from using this Transact-SQL technique. Table Direct mode against the Perf table and the Execute Result Set method called to create a Sql Ce Result Set object that initially is empty of data. Read to position the cursor at the start of the record set. The following screen shows the output from using Sql Ce Result Set.Many queries are posted on newsgroups asking how to improve performance when you use SQL Server Compact Edition.As the application and chart show, the Sql Ce Result Set object is the best way to achieve faster record inserts.Sql Ce Result Set not only gives performance benefits on inserts as shown earlier, but also in complex Transact-SQL queries involving joins and reading from single tables.The following code examples shows the differences in performance when 1000 records are inserted by using Transact-SQL, a Data Set object, and the Sql Ce Result Set object.The test application consists of a single form that contains a Data Grid control and a menu.This compatibility of programming models yields obvious benefits in that developers can program easily on both desktop and mobile platforms.However, the Data Adapter-Data Set model, although it makes perfect sense for a large database server that might have many hundreds or thousands of connections from client programs, is not the most efficient model for a local data store for a single application. Sql Server Ce to your Windows® Forms application enables developers for desktop and mobile device applications to take advantage of the improved performance.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.