FIX: "Not Enough Memory" Error with SQLCOLUMNS() and SQL Server (224989)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q224989

SYMPTOMS

In some cases, using the SQLColumns() function against a SQL Server table causes the following error:
There is not enough memory to complete this operation.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed

MORE INFORMATION

In the code below, the cconstring holds the following values for each parameter.

Driver=SQL Server
Server=Your SQL Server name
UID=Your user ID
PWD=Your password
APP=Microsoft(r) Visual FoxPro(r)
WSID=Workstation ID
DATABASE=The database name on SQL Server.

Steps to Reproduce Behavior

You might need to alter the syntax of the cconstring variable to obtain a valid connection to SQL Server.

Note The user, Username, must have permissions to perform these operations on the database.
  1. Create a program that contains the following code and save it:
    CLOSE DATA ALL
    cconstring = "DRIVER=SQL Server;SERVER=SPHINXSQL;UID=UserName;PWD=StrongPassword;APP=Microsoft(r) Visual FoxPro(r);WSID=WS2;DATABASE=pubs"
    PUBLIC hand
    SET SAFETY OFF
    DELETE FILE testdb.DBC
    DELETE FILE testdb.dc?
    CREATE DATA testdb
    CREATE CONNECTION testconn CONNSTRING (cconstring)
    
    hand=SQLCONNECT("testconn")
    
    ?hand
    ?SQLColumns(hand,"Publishers","FoxPro","curFields") < 0
    *?SQLColumns(hand,"Publishers","FoxPro","curFields")
    ?sqldisconnect(hand)
    
    					
  2. Run the program.
After the program runs, you get the error:
There is not enough memory to complete this operation.
Note that the error does not occur every time you use the SQLColumns() function. In the example, if you change this line of code:
?SQLColumns(hand,"Publishers","FoxPro","curFields") < 0
				
to this line:
?SQLColumns(hand,"Publishers","FoxPro","curFields")
				
the code runs without error.

Modification Type:MajorLast Reviewed:11/1/2003
Keywords:kbBug kbDatabase kbfix kbSQLProg kbVS600sp3fix KB224989