KeywordsPHP uses COM objects to access SQL Server Access
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);
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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.