Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Client App Won't Pickup SQL OUTPUT PARAMETER

Status
Not open for further replies.

metsey

Programmer
Mar 2, 2001
49
US
I have the following VB 6 code calling a sp in SQL 7.0. The sp returns a value through an output parameter. I cannot get the VB app to pickup the output parameter value.

With g_adoComm
.CommandType = adCmdStoredProc

' set the name of the stored procedure
.CommandText = "usp_GroupDesign"

' create and append the input parameter
.Parameters.Append g_adoComm.CreateParameter("ClientCode", adBSTR, adParamInput)

' set the initial value of the parameter
.Parameters("ClientCode").Value = sClient

' create and assign output parameter value to function output
.Parameters.Append g_adoComm.CreateParameter("@Client", adBSTR, adParamOutput)

'set connection object
.ActiveConnection = g_adoConn

.Execute

vReturn = .Parameters("@Client").Value

How do I get the client app to recognize the SQL Output Param? Any help would be greatly appreciated.

Mark
 
Hi,

I know that a couple of programming languages cannot make use of the output parameter of a SP. What they can use is the output of the last statement in a SP.
I.E. Select * from table. Returns the complete content of the table to the programming language.

In FoxPro you can execute a SP and the resultset will be returned in a Cursor. I believe (hope) this can also be done in VB6.

JNC73
 
VFP supports returned output parameters (not just cursors) (see the FAQ in the VFP forum faq184-70), so it is an even-money bet that VB will support it. You probably need to declare the variable and pass it in the SP call; the VFP example in the FAQ, which largely uses the ODBC CALL syntax and is language independent, may help. Robert Bradley
teaser.jpg

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top