PHP uses COM objects to Access SQLServer and Access. PHP4.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. For an ASPCoder, you can access COM and DCOM objects on the Win32 Platform at PHP4.0.6 or later. 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 );
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 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.
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...