作者:backup哗哗-1996 | 来源:互联网 | 2018-07-17 01:41
ec(2);php文件<?define("OLEDB_CONNECTION_STRING","ProviderSQLOLEDB;DataSourcezzb;InitialCatalogNorthwind;UserIDsa;Password");$dbcnewCOM("ADODB.Co
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
Directive |
Local Value |
Master Value |
;
while (!$rs->EOF) {
$i += 1;
$fld0 = $rs->Fields(0);
$fld1 = $rs->Fields(1);
$fld2 = $rs->Fields(2);
print
;
print $fld0->value;
print
|
;
print $fld1->value;
print | ;
print $fld2->value;
print |
;
$rs->MoveNext();
}
print
;
$rs->Close();
?>
注意的是,你的服务器必须打开!另外,就是不能写错存贮过程的名称。否则会出项致命的错误,而且,你根本就不知道错误在那里,这就是php文件对错误处理的不好之处,但相信它以后是会改进的。