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

ID: Q150979

2.60a MS-DOS

 kbprg kbbuglist

The information in this article applies to:

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: kbprg kbbuglist KBSubcategory: FxenvAutoexec

Keywords          : kbenv FxenvAutoexec kbbuglist
Version           : 2.60a
Platform          : MS-DOS

Last Reviewed: May 14, 1998