This article has been archived. It is offered "as is" and will no longer be updated.
This article describes how to build an OLE DB application for Microsoft SQL Server 2000 Windows CE Edition 2.0 (SQL Server CE) in Microsoft Visual Studio 2005. This article uses the NorthwindOleDb sample application that is installed with Visual Studio 2005 in an example.
To build an OLE DB application for SQL Server CE in Visual Studio 2005, you must include the new Ssceoledb.h file in the application. The new Ssceoledb.h file is an integration of the Oledb.h file, the Oledb.lib file, and the previous Ssceoledb.h file. To obtain the new Ssceoledb.h file, download the Ssceoledb.exe file from the Microsoft Download Center.
The following file is available for download from the Microsoft Download Center:
For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
The following example shows how to build an OLE DB application for SQL Server CE in Visual Studio 2005. This example modifies the original version of the NorthwindOleDb sample application for SQL Server CE that is running on a Microsoft Windows Mobile-based device. To build the application, follow these steps:
Extract the Ssceoledb.h file from the Ssceoledb.exe file.
Copy the Ssceoledb.h file to a folder where Visual Studio 2005 can find the file and include the file in the application.
Extract the NorthwindOleDb.zip package from the following folder:
SQL2005Install:\Program Files\Microsoft SQL Server 2005 Mobile Edition\Samples\NorthwindOleDb
In this folder, SQL2005Install is a placeholder for the drive where you install Microsoft SQL Server 2005.
If you cannot find the NorthwindOleDb.zip package, click the following article number to view the article in the Microsoft Knowledge Base:
909751 The NorthwindOleDb sample application is not available when you install SQL Server Mobile Edition from a SQL Server 2005 installation
Step 4 assumes that you extract the NorthwindOleDb.zip package to drive C. You can select a different drive.
Open the C:\northwindoledb folder, and then double-click the Northwindoledb.sln file. The NorthwindOleDb sample application opens in Visual Studio 2005.
In Solution Explorer, right-click Header Files, point to Add, and then click Existing Item.
To add the Ssceoledb.h file to the Header File list, locate the folder where you copied the Ssceoledb.h file, and then double-click the Ssceoledb.h file.
In all the source files in this application, delete the following line of code.
In all the source files in this application, locate the following line of code.
Replace this line of code with the following line of code.
Make this replacement because the Ssceoledb30.h file is used in Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) OLE DB applications.
Note In this line of code, MyPath is a placeholder for the folder where you copied the Ssceoledb.h file. Alternatively, you can add the MyPath folder to the include folder in Visual Studio 2005.
If the Oledb.lib file is in the link library, delete the Oledb.lib file.
In all the source files in this application, delete the lines of code that contain the DBINITCONSTANTS symbol, the OLEDBVER symbol, and the INITGUID symbol.
In all the source files in this application, change the CLSID_SQLSERVERCE_3_0 class identifier to the CLSID_SQLSERVERCE_2_0 class identifier.
In Solution Explorer, right-click Northwindoledb, and then click Properties.
In the left pane, expand Configuration Properties, expand Linker, and then click Input.
In the right pane, click Additional Dependencies, and then click the ellipsis button.
Make sure that the Ole32.lib file, the Oleaut32.lib file, and the Uuid.lib file are listed in the Inherited Values box. If any one of these files is not listed, manually add the file in the box over the Inherited Values box. These files are in the following folder:
VSInstall:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\Lib\armv4
Note In this folder, VSInstall is a placeholder for the drive where you install Visual Studio 2005.
Make sure that you call the following function before you call the OLE DB methods.
Build the application.
Deploy the application to the device.
You may not be able to run the application on the device. This problem may occur when SQL Server CE is not installed on the device. To manually install SQL Server CE on the device, follow these steps:
Copy the NetcfV1.platform.processor.cab file to the device from the following directory:
VSInstall:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v1.0\WindowsCE\platform\processor\
Note In these steps, platform is a placeholder for the operating system for the Windows Mobile 2003-based device or for the Windows Mobile 5.0-based device. Additionally, processor is a placeholder for the microprocessor for the Windows Mobile 2003-based device or for the Windows Mobile 5.0-based device.
On the device, click the NetcfV1.platform.processor.cab file to install the Microsoft .NET Compact Framework.
Copy the Sqlce20.dev.ppc.platform.processor.cab file and the Sqlce20.ppc.platform.processor.cab file to the device from the following directory:
VSInstall:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v2.0\platform\processor\
On the device, click the Sqlce20.dev.ppc.platform.processor.cab file and the Sqlce20.ppc.platform.processor.cab file to install SQL Server CE.
You can also add OLE DB error checking in the application. For more information about the OLE DB errors, see the "Using OLE DB Error Objects" topic in SQL Server CE Books Online.
For more information about how to build an OLE DB application for SQL Server CE on Microsoft Windows .NET devices, click the following article number to view the article in the Microsoft Knowledge Base:
825393 Building OLE DB applications for SQL Server CE 1.1, SQL Server CE 2.0, and Windows CE .NET