Consultor Eletrônico



Kbase P115105: OUTPUT parameter of MS SQL Server Stored Procedure returns wrong result when run via ADO in 4GL
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/04/2006
Status: Unverified

FACT(s) (Environment):

MS SQL

SYMPTOM(s):

Using ADO via 4GL

ADO calls a Stored Procedure on Microsoft SQL Server

Stored Procedure returns a value via an OUTPUT parameter

Value is always incorrect, returning a meaningless number
Example: 39112992

Using 4GL statement similar to the following to display the result of the Stored Procedure:

DISPLAY hCmd:Parameters("@iOut").

DataServer for Microsoft SQL Server is not used

Similar procedure written in Visual Basic returns the correct result

Using VB statement similar to the following to display the result of the Stored Procedure:

MsgBox hCmd.Parameters("@iOut")

CAUSE:

The 4GL code does not explicitly state what should be returned from the ADO Parameter class. Whilst Visual Basic forgives this, the 4GL needs to be told what to return, in this case the Value attribute of the Parameter.

FIX:

Add the Value attribute to the statement to get the result of the OUTPUT parameter from the Stored Procedure. For example:

DISPLAY hCmd:Parameters("@iOut"):Value FORMAT "x(50)".