BUG: Queries to SQL Server Fail in Stand-alone Extended .EXE

Last reviewed: May 23, 1996
Article ID: Q150979
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, version 2.6a

SYMPTOMS

Using the Connectivity Kit to query a SQL Server fails in FoxPro for an MS- DOS Stand-alone Extended .EXE file.

WORKAROUND

Build and use a compact .EXE file instead.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The FoxPro for MS-DOS Connectivity Kit allows users to connect and use tables on Microsoft SQL Server. If the application is compiled into a Stand- alone Extended .EXE file, the users can create a connection to the server in their application. However, DBEXEC() returns a -1 with no error message on any query that is sent to the SQL Server.

Steps to Reproduce Problem

  1. Create a new program called "testsql.prg."

  2. Enter the following code in the program:

          errmsg = ""
          errval = 0
          SET LIBRARY TO SYS(2004)+"FPSQL" ADDITIVE
          handle = DBConnect("Source_Name", ,"User","Password","Database")
          ** Source_Name is your server name.
          ** User is your login id.
          ** Password is your Password.
          ** Database is the name of a database on your SQL Server.
          ** A Connect to the Pubs Database might look like this
          ** handle: = DBConnect("DataServer1", "sa", "", "pubs").
          ** The rest of this example assumes a valid connection and a table
          ** named AUTHORS in the current database.
          WAIT WINDOW STR(handle)
          IF handle > 0
    
              retcode = DBExec(handle, "SELECT * FROM authors", "cursor")
          ENDIF
          IF retcode > 0
              WAIT WINDOW "Success"
              BROWSE
          ELSE
              err = DBError(handle, @errmsg, @errval)
              WAIT WINDOW str(errval)
              WAIT WINDOW errmsg
          ENDIF
          =DBDisconn(handle)
    
    

  3. Save and run the program in FoxPro to ensure that it works.

  4. Create a new project, and add the testsql.prg to it. (Make sure the testsql.prg is marked as the main program.)

  5. In Project Manager, select the Build button, and then choose Stand-alone Extended.

  6. Exit FoxPro, and run the .EXE file you created from the MS-DOS prompt.

REFERENCES

For more information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q112482
   TITLE     : How To Make an MS-DOS Level SQL Server Connection

See the Users Guide for the Connectivity Kit for information on using the individual commands.


Additional reference words: 2.60a FoxDos
KBCategory: kbenv kbprg kbbuglist
KBSubcategory: FxenvAutoexec



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 23, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.