web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Output parameters of stored procedure not coming

(0) ShareShare
ReportReport
Posted on by 20

I am calling one stored procedure from the Navision thru the ADO command. the procedure is containing the input and output both parameters. inside the procedure, I have written the update statement and sending a string through output parameters. but inside the Navision, I am not getting the output string. however, the stored procedure is getting executed successfully. if I am removing the update statement from the procedure then able to read the output string. 

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi Ghanshyam2402 ,

    Can you please show me your code here?

    Thanks

  • Ghanshyam2402 Profile Picture
    20 on at

    Hi Nitin,

    ltxtConnectionString := 'Driver={SQL Server};PROVIDER=SQLOLEDB;SERVER=10.10.0.***' +
    ';DATABASE=OperationProcess;UID=****;PWD=********';

    IF ISCLEAR(ADOConnection) THEN
    CREATE(ADOConnection,FALSE,TRUE);

    ADOConnection.ConnectionString:= ltxtConnectionString;
    ADOConnection.Open;

    IF ISCLEAR(ADOCommand) THEN
    CREATE(ADOCommand,FALSE,TRUE);

    VarActiveConnection := ADOConnection;

    ADOCommand.ActiveConnection := VarActiveConnection;
    ADOCommand.CommandText := 'OperationProcess.dbo.spr_Requisition_CreateTemplateDineInMenu';

    ADOCommand.CommandType := 4;
    ADOCommand.CommandTimeout := 0;

    ADOParameter:=ADOCommand.CreateParameter('@CommissaryLocation',200,1,100,CommissaryLocation);
    ADOCommand.Parameters.Append(ADOParameter);

    ADOParameter:=ADOCommand.CreateParameter('@OutletList',200,1,100,OutletList);
    ADOCommand.Parameters.Append(ADOParameter);

    ADOParameter:=ADOCommand.CreateParameter('@ProductionBOM',200,1,100,ProductionBOM);
    ADOCommand.Parameters.Append(ADOParameter);


    ADOParameter:=ADOCommand.CreateParameter('@success',200,2,100,'');
    ADOCommand.Parameters.Append(ADOParameter);

    ADOParameter:=ADOCommand.CreateParameter('@msg',200,2,100,'');
    ADOCommand.Parameters.Append(ADOParameter);


    ADOCommand.Execute;

    ltxtResult := FORMAT(ADOCommand.Parameters.Item('@msg').Value);
    MESSAGE(ltxtResult);


    ltxtResult := FORMAT(ADOCommand.Parameters.Item('@success').Value);
    MESSAGE(ltxtResult);


    ADOConnection.Close;
    CLEAR(ADOConnection);

  • Ghanshyam2402 Profile Picture
    20 on at

    hi Nitin Verma, seeking your help on this

  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    Can you please mark which one is output parameter in the code?

    Thanks.

  • Ghanshyam2402 Profile Picture
    20 on at

    ---Sending output parameters to the procedure

    ADOParameter:=ADOCommand.CreateParameter('@success',200,2,100,'');

    ADOCommand.Parameters.Append(ADOParameter);

    ADOParameter:=ADOCommand.CreateParameter('@msg',200,2,100,'');

    ADOCommand.Parameters.Append(ADOParameter);

    ---fetching output parameters from the procedure

    ltxtResult := FORMAT(ADOCommand.Parameters.Item('@msg').Value);

    MESSAGE(ltxtResult);

    ltxtResult := FORMAT(ADOCommand.Parameters.Item('@success').Value);

    MESSAGE(ltxtResult);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,092

#2
YUN ZHU Profile Picture

YUN ZHU 663 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 515

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans