Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Call a DB2 stored procedure
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00509495
Message ID:
00509528
Views:
23
>>I am using DB2 Connect to access DB2 and have had great performance. I use SQLCONNECT() and then SQLEXEC() with standard parameters.
>>
>>Now I have a stored procedure on DB2 and I cannot figure out how to fire it off. Can someone please give me a clue? The procedure has two input variables and two output variables.

If you can't get it to work using SQL pass through you might want to try using the ADO connection and command objects. I prefer this approach.
oConn=createobject("ADODB.connection")
oConn.open("DSN=YourAS400Name;UID=YourUserID;PWD=YourPassword")
oCom=CREATEOBJECT("ADODB.Command")
With oCom
   .CommandText = "{CALL LibraryName.StoredProcedureName(?,?)}"	&&Pass two parameters
   .ActiveConnection = oConn
   .CommandType = ADCMDTEXT
   .Prepared = .T.
   .Parameters.Append (.CreateParameter("Parm1",adChar,adParamInputOutput,25))
   .Parameters.Append (.CreateParameter("Parm2",adChar,adParamInputOutput,10))
   .Parameters("Parm1").value = "SOME PARM 1 DATA HERE    "
   .Parameters("Parm2").value = "HELLOWORLD"
   .Execute
   m.Parm1Data=.Parameters("Parm1").value
   m.Parm2Data=.Parameters("Parm2").value
Endwith
Release oCom
oConn.close
Release oConn
Michael McLain
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform