PRB: Programmatically Adding Stored Procedure May Cause Error

Last reviewed: February 28, 1997
Article ID: Q164355
5.00 WINDOWS kbprg kbprb

The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 5.0

SYMPTOMS

The following error may appear when you programmatically add a stored procedure to a database container with the APPEND PROCEDURES FROM command and set SAFETY to ON:

   Warning: The procedures contain compile errors. Would you like
   to add them anyway?

The dialog box has a choice to Add or Cancel.

RESOLUTION

You should add either a blank line to the beginning of the file being appended or a carriage-return line-feed to the end of the database stored procedure.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

Execute the following code, which creates a database container and a procedure file:

   SET SAFETY ON
   CREATE DATABASE proctest
   SET DATABASE to proctest
   mhandle = FCREATE("proctest.txt")
   =FWRITE(mhandle, "PROCEDURE proctest"+chr(10)+ ;
                    "   WAIT WINDOW 'proctest'"+ chr(10)+ ;
                    "ENDPROC")
   =FCLOSE(mhandle)
   MODIFY PROCEDURE

After closing the Stored Procedures window, issue the following from the Command window:

   APPEND PROCEDURES from proctest.txt

Issue the APPEND PROCEDURES again and the error should occur.

If the text file is edited to add a blank line to the beginning of the file, the error does not occur.

If FPUTS is used instead of FWRITE during the creation of the procedure file, the error does not occur because FPUTS appends a carriage-return, line-feed to end of the file, which allows the newly appended procedure to start after, rather than on, the last line of the stored procedures.

Setting SAFETY OFF, does not show the error dialog box and the procedure is appended to the stored procedures but not necessarily in the correct location.


KBCategory: kbprg kbprb
KBSubcategory: FxotherGeneral FxprgGeneral vfoxwin
Additional reference words: 5.00
Keywords : FxotherGeneral FxprgGeneral vfoxwin kbprb kbprg
Version : 5.00
Platform : WINDOWS


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: February 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.