PHP4.0.6 above can access COM and DCOM objects in the Win32 platform. Here to borrow the ASP idea to visit SQL Server. Of course you can also use the MSSQL series function. If it is an ASP coder, you will feel the following code very familiar, accustomed to----without him, but PHP Changl ~_~:
Author:erquan
Date:2003-3-4
City: Zhengzhou
$dbConn =new COM ("ADODB. Connection ") or Die (" Create COM Failed ");
$ADO = "Provider=sqloledb;data source=localhost;initial catalog=mytest; User Id=sa; Password=sa; ";
Access such as: $ADO = "Driver={microsoft Access DRIVER (*.mdb)}; Dbq= ". Realpath ("Mydb.mdb");
$dbConn->open ($ADO);
if ($dbConn) echo "Create conn OK";
$rs =new COM ("ADODB. RecordSet ") or Die (" Create RS failed ");
Echo
";
if ($rs) echo "Create Rs OK";
$sql = "SELECT * from Tb_bs";
$rs->open ($sql, $dbConn, 1, 1);
while (! $rs->eof) {
echo $rs->fields["I_bsid"]->value. ":";
echo $rs->fields["Vc_bsname"]->value;
Echo
";
$rs->movenext ();
}
$rs->close;
$rs =null;
$dbConn->close;
$dbConn =null;
?>
How's that, easy? For ASP coder, if suddenly your boss received a PHP project list, you do not have to panic, spend a little time you can also successfully develop the ~
Accessing SQL Server's stored procedures is almost the same as ASP's practice.
http://www.bkjia.com/PHPjc/314819.html www.bkjia.com true http://www.bkjia.com/PHPjc/314819.html techarticle PHP4.0.6 above can access COM and DCOM objects in the Win32 platform. Here to borrow the ASP idea to visit SQL Server. Of course you can also use the MSSQL series function. If it is an ASP coder, you ...