Compiling OLE DB Applications

OLE DB and SQL Server

OLE DB and SQL Server

Compiling OLE DB Applications

OLE DB applications must include Oledb.h, Sqloledb.h, and Oledberr.h (if using error constants defined in this file) files. Most applications use wide character strings to make OLE DB function calls. If applications are using TCHAR variables, the application must include #define UNICODE in the application. It converts the TCHAR variables to wide character strings. OLE DB applications must be linked with the Oledb.lib file. In a custom installation of Microsoft® SQL Server™ 2000, the header files are installed in the C:\Program Files\Microsoft SQL Server\80\Tools\Dev Tools\Include directory and the library files are installed in the C:\Program Files\Microsoft SQL Server\80\Tools\Dev Tools\Lib directory. The SQL Server Include and Lib directories are located in the INCLUDE and LIB path on the compiler.

The latest versions of these files can be downloaded with the latest Microsoft Data Access SDK from Microsoft Web site. If you have downloaded a version of the Microsoft Data Access SDK and the dates are later than the dates for SQL Server 2000, place the MSDA directories before the SQL Server 2000 directories. For example:

LIB=c:\msdasdk\oledb\lib;c:\Program Files\Microsoft SQL Server\80\Tools\Dev Tools\lib;c:\msdev\lib;
   c:\msdev\mfc\lib
INCLUDE=c:\msdasdk\oledb\include;c:\Program Files\Microsoft SQL Server\80\Tools\Dev Tools\include;
   c:\msdev\include;c:\msdev\mfc\include