Microsoft KB Archive/242027

= SAMPLE: Embedcgi.exe CGI Application Shows How to Use Embedded SQL =

Article ID: 242027

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft SQL Server 6.5 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q242027



SUMMARY
The Embedcgi.exe sample shows you how to use embedded SQL in a Common Gateway Interface (CGI) application. This sample works with any CGI-compatible Web server, for example, Microsoft Internet Information Server (IIS).



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

Embedcgi.exe

The Embedcgi.exe file contains the following files:

Release Date: Feb. 03, 2000

For additional 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 to prevent any unauthorized changes to the file.

Compiling the Sample
 In the Microsoft Visual C++ Integrated Development Environment (IDE), on the Tools menu, click Options, and then click the Directories tab. In the Show Directories For box, click Include Files, and then add the Include folder for the SQL Server developer tools. For example:

c:\mssql7\devtools\include

 Click Library Files in the Show Directories For box. Add the Lib folder for the SQL Server developer tools. For example:

c:\mssql7\DevTools\lib

 Open the Embedcgi.dsp project in Visual C++.  Modify the Embedtst.sqc file so that the server name, database, user ID, and password variables match your computer configuration. The following two lines need to be changed: char szSERVERNAME[]= "MYSERVER.pubs"; char szUID_PWD[]= "sa."; Note that this sample uses the SQL Server sample Pubs database.  On the Project menu, click Settings, and then click the Custom Build tab. Change the command to point to the correct location of the Nsqlprep.exe file on your computer. For example:

c:\mssql7\Binn\nsqlprep.exe $(inputname)

 Compile your application.

NOTE: The project contains a reference to a source file named Embedtst.c. This file is created by the Nsqlprep precompiler, so it does not need to exist prior to building the project.</li></ol>

Using the Sample
<ol> Copy the compiled .exe file into the Script folder of the default Web server folder. For IIS, this folder is by default called "Scripts" and is located immediately under the Inetpub folder. For example:

C:\Inetpub\Scripts

</li> Make sure that IIS has sufficient rights to run Scripts in this folder.</li></ol>

Calling Your CGI Application from a Web Browser
To call your CGI application, type the following in your browser's address edit box:

http://WEBSERVER/scripts/embedded.exe?,,

Additional query words: Embedcgi

Keywords: kbhowto kbdatabase kbfile KB242027

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.