简体   繁体   English

从存储过程获取输出参数

[英]Getting output parameter from stored procedure

I'm trying to get the stored procedure to fire and return the output parameter as well as the result set. 我正在尝试启动存储过程并返回输出参数以及结果集。 Currently I just get the result set array with a balnk variable where the output parameter should be. 目前,我只得到带有balnk变量的结果集数组,输出参数应该在该数组中。

//initiate function
    $proc = mssql_init('usp_Web_Return_Installer_Details', $msdb); 

    $enrolledScopes = '';

    mssql_bind($proc, '@InstallerID', $_SESSION['user']['Installer_ID'], SQLINT4, false, false, 10);

    mssql_bind($proc, '@EnrolledScopes', &$enrolledScopes, SQLVARCHAR, true, true, 5000); 

    //Execute Procedure 
    $result = mssql_execute($proc); 

    do {
    while ($row = mssql_fetch_assoc($result)){
        $results[] = $row;    
        }
    } while (mssql_next_result($result));

    //Free Memory 
    mssql_free_statement($proc); 

    print_r($result);

You need to add mssql_bind for your output parameter from storedprocedure 您需要为mssql_bind的输出参数添加mssql_bind

mssql_bind($stmt, "@outParam", &$outParam, true)

So, $outParam is your result. 因此, $outParam是您的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM