PHP MSSQL 存储过程的方法

前端之家收集整理的这篇文章主要介绍了PHP MSSQL 存储过程的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="8127" class="copybut" id="copybut8127" onclick="doCopy('code8127')"> 代码如下:

<div class="codebody" id="code8127">
function generateDocCode() {
$wf_id = self::WORKFLOW_ID;
$doc_code = "";
$link = mssql_connect($this->cfg->db->params->host,$this->cfg->db->params->username,$this->cfg->db->params->password) or die("Can't connect sql server");
mssql_select_db($this->cfg->db->params->dbname,$link) or die("Select database failure");
$stmt = mssql_init("GenerateDocCode",$link) or die("initialize stored procedure failure");
mssql_bind($stmt,"@wf_id",$wf_id,sqlINT4);
mssql_bind($stmt,"@doc_code",$doc_code,sqlVARCHAR,true);
mssql_execute($stmt,false);
//print "Doc Code is: ".$doc_code;
return $doc_code;
}

调用mssql_init语句用于初始化存储过程,而后调用mssql_bind语句指定存储过程参数,最后调用mssql_execute执行存储过程。

原文链接:https://www.f2er.com/php/29352.html

猜你在找的PHP相关文章