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. If it is an ASP Coder, you will think the following code is very familiar and used to ---- No other, but php strong ~ _~ :
<? Php
// 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 "<br> ";
// 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 "<BR> ";
$ 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.