Use ADO to call Asscess databases and COM programs in PHP
Source: Internet
Author: User
Php (as the mainstream development language) 4 already supports Microsoft's COM technology. However, the COM section is rarely mentioned in this document. Here are some examples I have tried. I hope these will give you some ideas. Note that these can only run on 32-bit Microsoft Windows platforms. Use php (as the current SyntaxHig
Php (as the mainstream development language) 4 already supports Microsoft's COM technology. However, the COM section is rarely mentioned in this document.
Here are some examples I have tried. I hope these will give you some ideas. Note that these can only run on a 32-bit Microsoft Windows platform.
Use php (as the mainstream development language) to activate ADO ADO is Microsoft's database object technology. ADO contains the objects that connect to the database, the record set objects that return data from the query statement, and the field objects that represent data elements.
Many databases do not directly support ADO. Instead, many databases support two levels of Microsoft Database Technology: ODBC and OLEDB. many databases support ODBC, but OLEDB has a reputation for being faster than ODBC.
ADO is the API for packaging ODBC and OLEDB.
In this example, open a new ADO Connection object, open a traditional access (favorite of small websites) database for ODBC, and then execute SQL query, a record set object will be returned. Then we will display the first three fields of the record set.
$ 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 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 ");
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.