复制代码 代码如下:
<?
$conn=mssql_connect("127.0.0.1","user","passwd");
mssql_select_db("mydb");
$stmt=mssql_init("pr_name",$conn);//
$a=50001;
mssql_bind($stmt,"RETVAL",$val,SQLVARCHAR); //用于直接返回return -103此类的值。
mssql_bind($stmt,"@outvar",$b,SQLVARCHAR,true);//用于返回在存储过程中定义的输出参数
mssql_bind($stmt,"@invar",$a,SQLINT4);
$result = mssql_execute($stmt,true);//不能返回结果集,只能得到输出参数
//$result = mssql_execute($stmt,false); //返回结果集
//$records=mssql_fetch_array($result);
//print_r($records);
//mssql_next_result($result);下一个结果集,当等于FALSE的时候下一个就是输出参数
echo $b;
echo $val;
?>
复制代码 代码如下:
// 初始化要传进存储过程的参数们:
$nYear = 2004;
$nPageSize = 20;
$nPageNo = 1;
// Initializes a stored procedure:
$stmt = mssql_init("proc_stat_page", $db_mssql->Link_ID);
// 绑定输入参数:
mssql_bind($stmt, "@nReturn", $nReturn, SQLINT4, TRUE);
mssql_bind($stmt, "@nYear", $nYear, SQLINT4);
mssql_bind($stmt, "@nPageSize", $nPageSize, SQLINT4);
mssql_bind($stmt, "@nPageNo", $nPageNo, SQLINT4);
// 执行存储过程,得到QueryID:
$db_mssql->Query_ID = mssql_execute($stmt,false);
新闻热点
疑难解答