首页  >  文章  >  后端开发  >  PHP MSSQL 存储过程的方法_PHP教程

PHP MSSQL 存储过程的方法_PHP教程

WBOY
WBOY原创
2016-07-21 15:48:021035浏览

复制代码 代码如下:

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执行存储过程。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/319864.htmlTechArticle复制代码 代码如下: function generateDocCode() { $wf_id = self::WORKFLOW_ID; $doc_code = ""; $link = mssql_connect($this-cfg-db-params-host, $this-cfg-db-params-username, $t...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn