Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Output parameters of stored procedure not coming

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. 

  • Ghanshyam2402 Profile Picture
    Ghanshyam2402 20 on at
    RE: Output parameters of stored procedure not coming

    ---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);

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Output parameters of stored procedure not coming

    Hi,

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

    Thanks.

  • Ghanshyam2402 Profile Picture
    Ghanshyam2402 20 on at
    RE: Output parameters of stored procedure not coming

    hi Nitin Verma, seeking your help on this

  • Ghanshyam2402 Profile Picture
    Ghanshyam2402 20 on at
    RE: Output parameters of stored procedure not coming

    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);

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Output parameters of stored procedure not coming

    Hi Ghanshyam2402 ,

    Can you please show me your code here?

    Thanks

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans