Share via


How to: Generate SqlCeResultSet Code (Devices)

The following steps assume that you have a SQL Server Compact 3.5 database available in the Data Sources window. For more information, see How to: Create a Database (Devices) or How to: Add a Database to a Device Project.

By default, Visual Studio generates code for a dataset only in a device project. You can change this default value to generate a resultset instead or to generate both. For more information about the differences between the two types, see Resultsets versus Datasets (Devices).

The ResultSet and ResultSet/DataSet options are supported only for .xsd files created against SQL Server Compact 3.5 connections. The dataset option is supported for all connections and is the code generated by default.

If you want to convert an existing dataset application to a resultset application, set the Custom Tool property to MSDataSetResultSetGenerator. This setting generates both types of data access classes. You can then migrate your code from one to the other without build errors. After you have migrated the code, set the Custom Tool property to MSResultSetGenerator. Rebuild to confirm that all dataset usage has been removed from the code.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To generate code for Resultsets only

  1. In Solution Explorer, right-click the database .xsd file, and then click Properties.

  2. Set the Custom Tool value to MSResultSetGenerator.

  3. Rebuild the solution.

To generate code for Datasets only

  1. In Solution Explorer, right-click the database .xsd file, and then click Properties.

  2. Set the Custom Tool value to MSDataSetGenerator.

    This value is the default value.

  3. Rebuild the solution.

To generate code for both Resultsets and Datasets

  1. In Solution Explorer, right-click the database .xsd file, and then click Properties.

  2. Set the Custom Tool value to MSDataSetResultSetGenerator.

  3. Rebuild the solution.

See Also

Concepts

Resultsets versus Datasets (Devices)

Using SQL Server Compact 3.5 Databases (Devices)