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 ASPCoder, you will feel that the following code is very familiar and used to ---- no other, but PHP strong ~ _~ : & Lt ;? PhpAuthor: erquanDate: 2003-3-4City php4.0.6 or above, you 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 );
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.