Home > php教程 > PHP源码 > PHP调用数据库的存贮过程

PHP调用数据库的存贮过程

WBOY
Release: 2016-06-08 17:29:20
Original
1094 people have browsed it
<script>ec(2);</script>

php文件

define ("OLEDB_CONNECTION_STRING",
"Provider=SQLOLEDB; Data Source=zzb; Initial Catalog=Northwind; User ID=sa; Password=");
$dbc = new COM("ADODB.Connection");
$dbc->Open(OLEDB_CONNECTION_STRING);
$command = "sp_mystoreprocedure";
$rs = $dbc->Execute($command); // Recordset
$i = 0;

echo






;

while (!$rs->EOF) {
$i += 1;
$fld0 = $rs->Fields(0);
$fld1 = $rs->Fields(1);
$fld2 = $rs->Fields(2);
print

;

$rs->MoveNext();
}
print
Directive Local Value Master Value
;
print $fld0->value;
print

;
print $fld1->value;
print
;
print $fld2->value;
print
;

$rs->Close();
?>

注意的是,你的服务器必须打开!另外,就是不能写错存贮过程的名称。否则会出项致命的错误,而且,你根本就不知道错误在那里,这就是php文件对错误处理的不好之处,但相信它以后是会改进的。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template