问题
I built a stock manager on VB.NET, it uses a MS Access Database. I also built a website, and on this website I want to relularly upload the updated MS Access database file onto the website and insert it into the mySql Database. Now my problem is I dont know how to access the MS Access file using php, im sure theres a way without buying those softwares, but i cant find it. Now I not bound to this scenario, if someone has better ideas i would appreciate it, most importantly I want the stock management to be offline, and at the end of the day, i want it uploaded to the site. Thanks alot
回答1:
I have done that in the past using ADODB and JET:
// connect
$conn = new COM('ADODB.Connection');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={$database};Mode=ReadWrite;");
//query
$results = $conn->Execute($sql);
// retrieve
$results->Fields[$field]->Value;
// navigation
$results->MoveNext();
$results->Move($count);
$results->EOF();
// Close (don't forget)
$conn->Close();
This is just a small sample. More Help
回答2:
Look into php_odbc
which has the ability to communicate with MS Access if you have correctly configured an ODBC data source on the PHP server. php_odbc documentation here.
// From the `odbc_connect()` documentation:
// Microsoft Access
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $user, $password);
来源:https://stackoverflow.com/questions/6062033/using-access-database-in-php