XXX Chats

daegu dating sites

Updating records using cursors

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

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.

updating records using cursors-68

The following code example shows how to use the Data Set approach to insert the records.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.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.The table in the database, which is empty at first, is populated by using three techniques, then the inserted records are displayed in the Data Grid control, and finally the application displays the elapsed time for the operation.To create a test application Each approach that is used to populate the table follows the same pattern.The following code example shows the Transact-SQL statement that is used to retrieve the data.SELECT [Order Details].[Order ID], [Order Details].[Product ID], Products.[Product Name], [Order Details].[Unit Price], [Order Details]. Discount, CONVERT(money, ([Order Details].[Unit Price] * [Order Details]. Discount) / 100) * 100 AS Extended Price FROM Products INNER JOIN [Order Details] ON Products.[Product ID] = [Order Details].[Product ID] private void mnui Data Set_Click(object sender, Event Args e) You have already seen how to use a Sql Ce Command object in Table Direct mode as a fast way to retrieve records from a single table through a Sql Ce Result Set.SQL Server Compact Edition offers the Sql Ce Result Set object as an alternative, which yields better record insert and retrieval performance compared to processing Transact-SQL commands or using the Data Adapter and Data Set objects. Reading from a database conventionally follows the desktop approach of using a Data Adapter object to connect to a database, to retrieve rows, and then to load the data into a Data Set object or using Sql CECommand objects to execute Transact-SQL commands.The techniques described are supported by code samples that are written in Visual C#® and Visual Basic® that you can download by using the link under "Downloads." The techniques in this article do not only apply to the . Sql Ce Result Set gives you an alternative and improved performance.

Comments Updating records using cursors