Building an OLE DB Application (SQL Server Compact)
You can create native desktop applications within Visual Studio 2010 SP1 IDE by using Microsoft Visual C++. This topic provides the information that you must have to start to build an OLE DB Visual C++ application.
Creating a Project
To create a new application, you first create the project in Visual Studio.
To create a new desktop project
In Visual Studio 2010 SP1, 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.
Including the SQL Server Compact 4.0 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 Compact OLE DB provider and the SQL Server Compact error file:
#include <sqlce_oledb.h>
#include <sqlce_err.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, 0, CLSCTX_INPROC_SERVER, IID_IDBProperties, (void**) &pIDBProperties);
See Also
Reference
OLE DB Provider Reference (SQL Server Compact)