The Embedded SQL setup program installs the source codes for several sample programs in C:\MSSQL\ESQL\SAMPLES.C by default.
Before you build any of the sample programs, you can use the SETENV.BAT batch file to set the COMPILER, INCLUDE, and LIB environment variables. Edit the SETENV.BAT file to set the variables as appropriate for your system.
You can build any of the sample programs by using one of two batch files that are included with the samples: MAKEC.BAT and MAKEW.BAT. Use MAKEC.BAT to build a C application for the Windows NT console and QuickWin environments. Use MAKEW.BAT to build Win16 and Win32 applications for graphical environments such as Windows NT, Windows 95, 16-bit Windows, and MS-DOS. All of the samples share the single make file MAKEFILE, which contains the steps and options that are necessary to build an Embedded SQL application.
Both the MAKEC.BAT and MAKEW.BAT batch files set environment variables that are used by MAKEFILE to control the build process. Edit the batch files to set the environment variables as appropriate for your system. For example, both batch files contain the lines:
set SERVER=my_server set LOGIN=my_login set PASSWORD=my_password set DATABASE=my_database
You must set these environment variables as appropriate for your SQL Server. For example:
set SERVER=gizmo set LOGIN=sa set PASSWORD= set DATABASE=pubs
When started, each sample application accepts the following command-line arguments for specifying the SQL Server, the login ID, the password, and the database to use as follows. Each sample application will generate a prompt for unspecified options.
program [{/s | /S} [server_name]] [{/u | /U} login_id] [{/p | /P} [password]]
[{/d | /D} database]
where
program
Is the Embedded SQL sample program you are starting.
server_name
Is the name of the SQL Server to connect to. If server_name is omitted, the local SQL Server is connected to.
login_id
Is the login ID of the SQL Server that is connected to.
password
Is the password of the SQL Server that is connected to. If password is omitted, a NULL password is assumed.
database
Is the database to use.