The following samples have been developed for ODBC version 3.0 and later. The samples have all been developed with Microsoft® Visual C++® version 4.2 and some expose properties of the Microsoft Foundation Classes available only in version 4.2 and later.
When you choose to install sample files, the ODBC 3.x samples are installed to the Mssql7\DevTools\Samples\Odbc directory.
All samples include a makefile and a project file (.mdp extension) created by Microsoft Visual C++ 4.2. The developer can use the makefile directly with nmake. Alternately, the makefile or project file can be opened in Microsoft Visual C++ 4.2 and later.
To open the makefile in Visual C++
When either the project file or the makefile is opened, Visual C++ generates appropriate supporting files.
The default build configuration for all samples is Win32® Release, which will build the samples as ANSI (not Unicode) 32-bit applications for Microsoft Windows® 95 or Microsoft Windows NT®. All samples contain at least the additional build configuration Win32 Debug. For configurations specifically supported by that sample, see each sample.
The ODBC 3.x samples have been built for Windows 95 and Windows NT version 4.0 operating systems. However, all the samples are available only for Intel® x86 versions of Visual C++. They have not been compiled or tested on any other hardware platform supported by the compiler.
Note To compile ODBC version 3.0 samples, you must obtain the ODBC 3.0 SDK available from Microsoft Press®, or the Microsoft Data Access SDK on the World Wide Web at http://www.microsoft.com/data.
All versions of the Microsoft Foundation Classes database classes are ODBC version 2.x compliant. 2.x versions of the ODBC header files Sql.h, Sqlext.h, and Sqltypes.h ship in the Include directory of Microsoft Visual C++. You must ensure that 3.x versions of the header files are included in the build process and that 3.x versions of the libraries are used for linking.
Additionally, the Microsoft SQL Server™ development files must be installed to have access to the SQL Server ODBC driver-specific header file Odbcss.h and the SQL Server ODBC driver-specific lib files. You must ensure that C:\Mssql7\DevTools\Include is in your compiler’s INCLUDE search path and C:\Mssql7\DevTools\Lib is in your linker’s LIB search path.
Some of the samples rely on sample data provided in the Mssql7\DevTools\Samples\Odbc\Data directory.
Three directories contain data for the samples. The BCP and LoadData samples each have a copy of the Microsoft Access-developed Northwind example data.
Directory | Description |
---|---|
Mssql7\DevTools\Samples\Odbc\Data\Northbcp | Contains a copy of the Northwind data |
Mssql7\DevTools\Samples\Odbc\Data\North | Contains a copy of the Northwind data |
Mssql7\DevTools\Samples\Odbc\Data\Trans | Contains data used by the transaction processing and concurrency control sample |
The sample data can be installed into any database. A Transact-SQL script, Createtb.sql, is installed into each sample data directory. The script creates the sample tables and stored procedures.
The scripts drop the tables they create so that they can be run multiple times as an example. Running the scripts in a database that contains data other than the supplied sample data could cause unintended results.
The sample data in C:\Mssql7\DevTools\Samples\ODBC\Data\Tran can be installed in any database. The sample data in the other two directories can be installed in any database except the Northwind sample database installed with SQL Server.
C:\Mssql7\Devtools\Samples\ODBC\Loaddata\Release\Loaddata.exe
C:\Mssql7\Devtools\Samples\ODBC\Bcp\Release\Bcpsamp.exe
cd C:\Mssql7\Devtools\Samples\ODBC\data\transloaddata
When loaddata.exe starts, connect to the data source defined in step 2. Open the command file lddist.cmd using the CommandFile window, and then click GO. Click Close when the commands complete.
cd C:\Mssql7\Devtools\Samples\ODBC\data\north loaddata
When loaddata.exe starts, connect to the data source defined in step 2. Open the command file ldnorthw.cmd using the CommandFile window, and then click GO. Click Close when the commands complete.
cd C:\Mssql7\Devtools\Samples\ODBC\data\northbcp bcpsamp
When BCPSamp.exe starts, connect to the data source defined in step 2. Open the command file bcpnorth.cmd using the CommandFile window, and then click GO. Click Close when the commands complete.