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 Very familiar, used to ---- without him, 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.