2012-05-04 56 views
1

我试图让存储过程触发并返回输出参数以及结果集。目前,我只是得到了一个输出参数应该是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); 

回答

0

你需要从StoredProcedure的

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

添加mssql_bind为输出参数所以,$outParam是你的结果。

+0

这就是这行应该做的: mssql_bind($ proc,'@EnrolledScopes',&$ enrolledScopes,SQLVARCHAR,true,true,5000); –

+0

是的。所以,结果应该是'$ enrolledScopes' –

+0

是的这就是我所说的,数组$结果返回预期的内容,但$ enrolledScopes是空的 –