Home > Backend Development > PHP Tutorial > Call Asscess database and COM program through ADO in PHP_PHP tutorial

Call Asscess database and COM program through ADO in PHP_PHP tutorial

WBOY
Release: 2016-07-13 17:32:04
Original
791 people have browsed it


 php(as the current mainstream development language)4 already supports Microsoft's COM technology. However, there is very little mention in the COM part of the document.
 
  Here are a few examples I’ve tried. Hope this gives you some idea. Note that these only run on 32-bit Microsoft Windows platforms.
 
 Use php(as the current mainstream development language)Activate ADO
 ADO is Microsoft's database object technology. ADO includes objects that connect to the database, recordset objects that return data from query statements, and field objects that represent data elements.
Many databases do not directly support ADO. Instead, many databases support two lower levels of Microsoft database technology: ODBC and OLEDB. Many databases support ODBC; but OLEDB has a reputation for being faster than ODBC.
 
 ADO is an API that wraps ODBC and OLEDB.
 
 This example opens a new ADO connection object and opens a traditional access to ODBC(favorite for small websites )database, then we execute the SQL query and a recordset object will be returned. Then we display the first three fields of the recordset.
 
 
 $dbc = new COM("ADODB.Connection");
 $dbc->Provider = "MSDASQL";
 $dbc->Open("nwind") ;
 $rs = $dbc->Execute("select * from products");
 $i = 0;
 while (!$rs->EOF) {
 $i + = 1;
$fld0 = $rs->Fields(0);
$fld1 = $rs->Fields(1);
$fld2 = $rs->Fields(2) ;
print "$fld0->value $fld1->value $fld2->value
";
$rs->MoveNext();
}
$rs ->Close();
 ?>
 
Use php(as the current mainstream development language) to call Microsoft Word
This is another example:
 
 
 $word=new COM("word.application") or die("Cannot start Microsoft Word");
 print "Loaded word version ($word->Version) ";
 $word->visible = 1;
 $word->Documents->Add();
 $word->Selection->Typetext("This is a test" );
 ?>
 

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508876.htmlTechArticlephp (as the current mainstream development language) 4 already supports Microsoft's COM technology. However, there is very little mention in the COM part of the document. Here are a few examples I've tried. Hope these give you some...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template