Building an OLE DB Application (SQL Server Compact Edition)
You can create native desktop and smart device applications from within the Visual Studio IDE by using Microsoft Visual C++. This topic provides the information that you must have to start building an OLE DB Visual C++ application.
Creating a Project
To create a new application, you first create the project in Visual Studio 2005.
To create a new desktop project
In Visual Studio 2005, on the File menu, point to New, and then select Project.
In the Project Types list of the New Project dialog box, expand the Visual C++ programming language, and then select the type of project you want to create. For example, to create an ATL project, select ATL.
Provide a name and location for your project, and then click OK.
Visual Studio creates a new project.
To create a new smart device project
In Visual Studio 2005, on the File menu, point to New, and then select Project.
In the Project Types list of the New Project dialog box, expand the Visual C++ programming language, and then select Smart Device.
In the Templates list, select the type of project you want to create. For example, to create an ATL project, select ATL Smart Device Project.
Provide a name and location for your project, and then click OK.
Visual Studio creates a new project.
Including the SQL Server Compact Edition OLE DB Provider
The next step in building an OLE DB-enabled application is to include the appropriate header files. In the main entry point for your application, add include statements for the SQL Server 2005 Compact Edition (SQL Server Compact Edition) OLE DB provider and the SQL Server Compact Edition error file:
#include <ssceoledb30.h>
#include <ssceerr30.h>
Create an Instance of the OLE DB Provider
The final step in using OLE DB in your application is to create an instance of the provider. The following code demonstrates how to do this:
hr = CoCreateInstance(CLSID_SQLSERVERCE_3_0, 0, CLSCTX_INPROC_SERVER, IID_IDBProperties, (void**) &pIDBProperties);
See Also
Reference
OLE DB Provider Reference (SQL Server Compact Edition)
Concepts
Native Programming How Tos (SQL Server Compact Edition)