PHP uses COM objects to Access SQLServer and Access
Source: Internet
Author: User
PHP uses COM objects to Access SQLServer and Access. PHP accesses SQLServer and Access using COM objects. PHP 4.0.6 and above can Access COM and DCOM objects on the Win32 Platform. Use ASP to access SQLServer. Of course, you can also use mssql functions. If it is an ASPCoder, you will feel that PHP 4.0.6 or above can access COM and DCOM objects on the Win32 Platform. Use ASP to access SQLServer. Of course, you can also use mssql functions. If it is an ASP Coder, you will think the following code is very familiar and used to ---- no other, but PHP strong ~ _~ :
// Author: erquan
// Date: 2003-4-4
// City: Zhengzhou
$ DbConn = new COM ("ADODB. Connection") or die ("failed to create COM ");
$ ADO = "Provider = sqloledb; Data Source = localhost; Initial Catalog = myTest; User Id = sa; Password = sa ;";
// Access example: $ 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 ("An error occurred while creating RS ");
Echo"
";
// If ($ rs) echo "create rs OK ";
$ SQL = "SELECT * FROM tb_bs ";
$ Rs-> open ($ SQL, $ dbConn, 1, 1 );
How are you doing? For ASP Coder, if your BOSS suddenly receives a list of PHP projects, you don't have to worry about it. you can develop it smoothly at a moment ~
The stored procedure for accessing SQLServer is almost the same as that of ASP.
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.