Export (0) Print
Expand All

Embedded SQL for C Samples

SQL Server 2000

By default, Microsoft® SQL Server™ 2000 Setup installs the Embedded SQL for C (ESQL/C) sample source code in x:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Samples\Esqlc.

Before you build any of the sample programs, use the Setenv.bat batch file to add the SQL Server development file header and library directories to the INCLUDE and LIB environment variables. Edit the Setenv.bat file to set the variables as appropriate.

You can build any of the sample programs using the supplied, general purpose makefile. The single makefile, Makefile, contains everything required to build an Embedded SQL program.

The default values for Makefile arguments support building the samples as Microsoft Win32® console applications. Makefile arguments can be supplied in the command prompt, or they can be set as environment variables for rapid processing of several example source files. For example, SET SERVER=MyServer could be used to cause nsqlprep to use MyServer as the build target for ESQL/C stored procedure creation.

Makefile argument Default value
Description
APP Name of the sample source file to build. Do not include a file extension.
UTIL Name of the utility source file. Do not include a file extension. The default value for the utility file is based on the value of the SUBSYS argument.
ENV dos Build sample for execution in Microsoft MS-DOS®.
win16 Build sample as a 16-bit Microsoft Windows® application.
qwin Build console applications as 16-bit Windows, QuickWin applications.
win32i Default. Build applications for 32-bit Windows operating systems.
MODEL medium When building a sample for MS-DOS or 16-bit Windows, build the sample for the medium memory model.
large Default. When building the sample for MS-DOS or 16-bit Windows, build the sample for large memory model.
SUBSYS console Default. Build sample as a console (command window) application. Specifying console causes the UTIL argument to default to gcutil.
windows Build the sample as a Windows application. Specifying windows causes the UTIL argument to default to gwutil.
DEBUG 0 Default. Build a release version of the sample. The executable does not contain debugger support.
1 Build a debug version of the sample.
SQLACCESS 0 Do not attempt to connect to a server running SQL Server and do not create stored procedures to support SQL statements embedded in C source code.
Attempt to connect to an instance of SQL Server and create stored procedures.
1 The default value of SQLACCESS is based on the presence or absence of a LOGIN argument value. Specify SQLACCESS to override the default assignment.
BIND 0 Default. Do not create a bind file.
1 Create a bind file.
SERVER Name of an instance of SQL Server to use for stored procedure creation.
LOGIN SQL Server login account. The identifier is used by nsqlprep to connect to the server for stored procedure creation.
PASSWORD SQL Server password. Used by nsqlprep to connect to the server.
DATABASE SQL Server database nsqlprep will use when creating stored procedures. The default is pubs.

For information about nmake command prompts that build a particular example, see the documentation for that example.

When started, each sample application accepts the following arguments for specifying an instance of SQL Server: the login ID, password, and database to use. Each sample application generates a prompt for unspecified options.

Syntax

program [{/s | /S} [server_name]]
[{/u | /U} login_id]
[{/p | /P} [password]]
[{/d | /D} database]

Arguments

program

Is the sample program started.

server_name

Is the name of an instance of SQL Server to connect to. If server_name is omitted, the local SQL Server instance is used.

login_id

Is the login ID of an instance of SQL Server to connect to.

password

Is the password of an instance of SQL Server to connect to. If password is omitted, a NULL password is assumed.

database

Is the database to use.

Show:
© 2014 Microsoft