Microsoft KB Archive/253939

= DOC: APPEND PROCEDURES Is Not Available at Run Time =

Article ID: 253939

Article Last Modified on 3/14/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q253939



SUMMARY
The documentation for Visual FoxPro 6.0 does not state that the APPEND PROCEDURES command is not a supported run-time feature. However, when the APPEND PROCEDURES command is used in a compiled .exe file, Visual FoxPro generates an error:

"Feature is not available."



Workaround
Beginning with Visual Studio 6.0 Service Pack 3, the Visual FoxPro 6.0 run-time library supports the COMPILE command. Using the COMPILE DATABASE and APPEND MEMO commands, you are able to reproduce the APPEND PROCEDURE behavior that is lacking in the run-time library.

Copy the following code to a .prg file and add that .prg file to a project. Compile the project into an .exe file, and run the .exe file: LOCAL cFileName, cProcedure, cHelloWorld2 cHelloWorld2 = 'HelloWorld2'
 * 1) DEFINE vfCRLF CHR(13) + CHR(10)

SET SAFETY OFF CLOSE ALL CREATE DATA AppendProc CREATE TABLE AppendProc (fld1 c(2))

cFileName = SYS(2015) + ".tmp"

cProcedure = "PROCEDURE HelloWorld2" + vfCRLF + ; "         WAIT WINDOW PROGRAM" + vfCRLF +; "ENDPROC" + vfcrlf = STRTOFILE(cProcedure, cFileName)
 * !* Make a text file that will be used for the stored procedure

CLOSE DATA ALL USE AppendProc.DBC LOCATE FOR objecttype = "Database" AND objectname = "StoredProceduresSource" IF FOUND APPEND MEMO CODE FROM (cFileName) ENDIF USE
 * !* This code will allow you to add a stored procedure to the database.
 * !* Database must be compiled before running stored procedures
 * !* added with this method.

COMPILE DATABASE AppendProc OPEN DATA AppendProc Do (cHelloWorld2) && Called as a variable to avoid compile error ERASE (cFileName) CLOSE DATA
 * !* Compile the database

Steps to Reproduce Behavior
Copy the following code to a .prg file and add that .prg file to a project. Compile the project into an .exe file and run it: LOCAL cFileName, cProcedure, cHelloWorld1 cHelloWorld1 = 'HelloWorld1'
 * 1) DEFINE vfCRLF CHR(13) + CHR(10)

SET SAFETY OFF CLOSE ALL CREATE DATA AppendProc CREATE TABLE AppendProc (fld1 c(2))

cFileName = SYS(2015) + ".tmp"

cProcedure = "PROCEDURE HelloWorld1" + vfCRLF + ; "         WAIT WINDOW PROGRAM" + vfCRLF +; "ENDPROC" + vfcrlf = STRTOFILE(cProcedure, cFileName)
 * !* Make a text file that will be used for the stored procedure

OPEN DATA AppendProc WAIT WINDOW [In Run-Time, the next command, APPEND PROCEDURE, will display "Feature is not available." error] APPEND PROCEDURES FROM (cFileName) OVERWRITE ERASE (cFileName) Do (cHelloWorld1) && Called as a variable to avoid compile error CLOSE DATA NOTE: Make sure you are not overlapping the Error Message window with other Windows applications on your desktop.
 * !* This code segment will produce a Run-Time error

