Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remote view
Message
 
 
À
23/07/2005 10:20:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01035375
Message ID:
01035387
Vues:
14
>Hi
>
> I have a Remote Connection for other VFP Databese. I have some Remote Views.
>Now, I want to run a Stored Procedure on that database.
>Stored Procedures is not on Local Database.
>How I can do it?
>
>********************
>In VFP help:
>
>OLE DB Provider for Visual FoxPro
>Calling a stored procedure using the conventional syntax:
>myStoredProc( Param1, Param2, ... )
>********************
>
>But it is for Local Database!!!!!!

No, you can call stored procedures this way from any DBC you access with VFP OLE DB Provider. Here's an example of calling VFP stored procedure that returns a cursor
lcConStr = "Provider=vfpoledb;Data Source=" + lcDBcName
oCon = CreateObject("ADODB.connection")
oCmd = CreateObject("ADODB.Command")
oRs  = CreateObject("ADODB.RecordSet")

oCon.Open(lcConStr)
oCmd.ActiveConnection = oCon
oRs.ActiveConnection = oCon

oCmd.CommandType = 4  && Stored Procedure
oCmd.CommandText = [RetProdRs("C%")]

oRs.Source = oCmd
oRs.Open()
...
* Stored procedure RetProdRs
PROCEDURE RetProdRs
LPARAMETERS tcPar1
SELECT * ;
	FROM prod ;
	WHERE eng_name LIKE tcPar1 ;
	INTO CURSOR crsRetRs 

	EXECSCRIPT([SETRESULTSET("crsRetRs")])
RETURN
This one shows how to call stored procedure that returns scalar value
oCmd.CommandType = 4  && Stored Procedure
oCmd.CommandText = [Test("Date :")]
oRs = oCmd.Execute()
* Display return value
? oRs.Fields("return_value").Value
...
PROCEDURE test(tcPrefix)
RETURN tcPrefix + Dtos(DATETIME())
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform