In PHP, how does one call Asscess databases and COM programs through ADO. Translated by znsoft: JohnLim. PHP4 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 concepts translated by znsoft: John Lim.
PHP4 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 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 database for ODBC, and then execute the 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 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 ");
?>
Author: John Lim. PHP4 has supported 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...