jawaidpk Posted March 12, 2007 Share Posted March 12, 2007 hello members, I want to write a script that can connect to the MS-Access database & then fetch data from there I got a code from a site which is as follows ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- <?php // Two versions of Microsoft Office. Choose one. //$db = 'C:\\Program Files\\Microsoft Office\\Office\\Samples\\Northwind.mdb'; $db = 'C:\\Program Files\\Microsoft Office\\Office10\\Samples\\Northwind.mdb'; $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.'); // Two ways to connect. Choose one. $conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.'); //$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or exit('Cannot open with driver.'); $sql = 'SELECT ProductName, QuantityPerUnit, UnitPrice FROM Products ORDER BY ProductName'; $rs = $conn->Execute($sql); ?> ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- but it generates an error like this "Cannot open with Jet.". Any one can help me regarding this error Link to comment https://forums.phpfreaks.com/topic/42312-connecting-php-with-ms-access/ Share on other sites More sharing options...
vbnullchar Posted March 12, 2007 Share Posted March 12, 2007 http://mavweb.net/asp-samples/quick-steps.asp $con = odbc_connect('dsn_name','',''); Link to comment https://forums.phpfreaks.com/topic/42312-connecting-php-with-ms-access/#findComment-205255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.