Calling your VFP program using OLE-DB provider
I never use VFP OLE-DB provider in my life. I am using VFP in my development, so I would access VFP database natively. I thought it is just as similar as other OLE-DB provider, only support SQL statement and stored procedure.
Today, I only realize we could run our prg from provider.
Here is the sample code provided by Aleksey Tsingauz (Microsoft) in UT. You could find out what commands are supported/unsupported in VFP OLE-DB provider here. Thank you Aleksey Tsingauz for sample code and David Stevenson (Editor of Foxtalk) for pointing me the url.
LOCAL oConn as ADODB.Connection
TEXT TO cPRG NOSHOW
RETURN "Here is the result"
ENDTEXT
STRTOFILE(cPRG,"c:\testPRG.prg")
oConn=CREATEOBJECT("ADODB.Connection")
oConn.Open("Provider=VFPOLEDB.1;Data Source=c:\")
oRS=oConn.Execute("testPRG",,4)
?oRS.Fields(0).Value
DELETE FILE c:\testPRG.prg
RETURN
0 Comments:
Post a Comment
<< Home