Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set procedure from a stored procedure
Message
De
16/12/2004 17:25:09
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Set procedure from a stored procedure
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00969869
Message ID:
00969869
Vues:
63
Hi all,
In the list of supported commands for rules, triggers, defaults and stored procedures in the Fox docs, it lists SET PROCEDURE as a valid command. I however can't seem to get it to work. Basically my call to SET PROCEDURE works, but when I try to call a function in the PRG it fails. However if I call a procedure in the prg by using DO Blah IN BlahPRG it works.

Here's the code I have in 3 files. The calling PRG (ConTest.prg)(This will actually be done from VB, but I created this as a test), the PRG that is referenced in the SET PROC command (SetMe.prg) and the stored procedure in the DBC.

Am I doing something wrong, or does this just not work?
*---------------------------------------------------------------------
*ConTest.prg
*---------------------------------------------------------------------
#include "adovfp.h"

LOCAL Con as ADODB.Connection
LOCAL Cmd as ADODB.Command
Con = CREATEOBJECT("ADODB.Connection")
Cmd = CREATEOBJECT("ADODB.Command")
Con.Open("Provider=vfpoledb.1;Data Source=.\sample.dbc")
Cmd.ActiveConnection = Con
Cmd.CommandText = "exec StoredTest('Test', 1234)"
Cmd.Parameters.Append(Cmd.CreateParameter("return_code", adChar, adParamReturnValue, 8))
Cmd.Execute &&OLEDB Provider Error: File 'settest.prg' does not exist.
?Cmd.Parameters.Item("return_code").Value
Cmd = ""
Con.Close
*---------------------------------------------------------------------


*---------------------------------------------------------------------
*SetMe.prg
*---------------------------------------------------------------------
FUNCTION SetTest
	PARAMETERS param1
	RETURN param1

PROCEDURE SetTestProc
	PARAMETERS param1
	RETURN
*---------------------------------------------------------------------

*---------------------------------------------------------------------
*Stored Procedure in sample.dbc
*---------------------------------------------------------------------
FUNCTION StoredTest
	PARAMETERS Param1, Param2
	LOCAL RetVal

	DO SetTestProc in SetMe with Param2  &&This works
	SET PROCEDURE TO SetMe
	RetVal = SetTest(Param1)  &&This Fails
	RETURN RetVal
*---------------------------------------------------------------------
Thanks in advance!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform