FIX: Stored Procedure Used with SQLEXEC Embeds NULL as Last Character

This article was previously published under Q279135
This article has been archived. It is offered "as is" and will no longer be updated.
When you use the SQLEXEC command to call a stored procedure from Visual FoxPro, a NULL (CHR(0)) may be added to the end of the fields in the resulting cursor.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the next service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:
194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed
To download the latest Visual Studio service pack, visit the following Microsoft Web site:

Steps to Reproduce Problem

  1. In Visual FoxPro, run the following code from the Command window.NOTE: You need to provide the actual servername, user ID, and password for your installation of Microsoft SQL Server and ensure that the user has the appropriate permissions.
    ?SQLSTRINGCONNECT("Driver=SQL Server; Server=servername;uid=UserName;pwd=StrongPassword;")?SQLEXEC(1, "sp_who")BROWSE
    In the Browse window, you may see a box or other ASCII character at the end of the status field, depending on the font that is used by the window.

  2. Close the Browse window.
  3. In the Command window, type the following:
    ? ASC(SUBSTR(status,LEN(status),1))					
    The Visual FoxPro command has embedded a NULL (CHR(0)) as the last character in the status field.

Article ID: 279135 - Last Review: 10/21/2013 03:37:40 - Revision: 2.2

Microsoft Visual FoxPro 6.0 Professional Edition

  • kbnosurvey kbarchive kbbug kbcodesnippet kbdatabase kbfix kbvfp600fix kbvs600sp5fix KB279135