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 <table cellSpacing="1" cellPadding="3" width="600" align="center" bgColor="#000000" border="0">
<tr vAlign="bottom" bgColor="#9999cc">
<th>Directive</th>
<th>Local Value</th>
<th>Master Value</th>
</tr>;
while (!$rs->EOF) {
$i += 1;
$fld0 = $rs->Fields(0);
$fld1 = $rs->Fields(1);
$fld2 = $rs->Fields(2);
print <tr vAlign="baseline" bgColor="#cccccc">
<td bgColor="#ccccff"><b>;
print $fld0->value;
print </b><br></td>
<td align="middle">;
print $fld1->value;
print </td><td align="middle">;
print $fld2->value;
print </td></tr>;
$rs->MoveNext();
}
print </TABLE>;
$rs->Close();
?>
注意的是,你的服务器必须打开!另外,就是不能写错存贮过程的名称。否则会出项致命的错误,而且,你根本就不知道错误在那里,这就是php文件对错误处理的不好之处,但相信它以后是会改进的。