Jump to content

Cannot open with Jet.


jarv

Recommended Posts

Is my code ok?

 

<?php


$db = 'C:\\Inetpub\\wwwroot\\php\\db\\tellist.mdb';

$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');

$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.');

$sql = 'SELECT * FROM phonebook';

$rs = $conn->Execute($sql);

?>

<table>
<tr>
<th>Client</th>
<th>Name</th>
<th>Number</th>
</tr>
<?php while (!$rs->EOF) { ?>
<tr>
	<td><?php echo $rs->Fields['rsClient']->Value ?></td>
	<td><?php echo $rs->Fields['rsName']->Value ?></td>
	<td><?php echo $rs->Fields['rsNumber']->Value ?></td>
</tr>
<?php $rs->MoveNext() ?>
<?php } ?>
</table>

<?php

$rs->Close();
$conn->Close();

$rs = null;
$conn = null;

?>

Link to comment
https://forums.phpfreaks.com/topic/47528-cannot-open-with-jet/
Share on other sites

ok I changed the JET line 8 and now line 8 looks like this:

 

$conn->Open("Microsoft Access Driver ; Data Source=$db");

 

this is my error:

 

PHP Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft OLE DB Provider for ODBC Drivers

Description: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified' in C:\Inetpub\wwwroot\php\test.php:8 Stack trace: #0 C:\Inetpub\wwwroot\php\test.php(8): com->Open('Microsoft Acces...') #1 {main} thrown in C:\Inetpub\wwwroot\php\test.php on line 8

Link to comment
https://forums.phpfreaks.com/topic/47528-cannot-open-with-jet/#findComment-232014
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.