Hello folks!
I need some help...I'm trying to interact with an MS Access database and would like to know if someone has already experienced such a problem.
I'm accessing MSAccess database without ODBC (constraint imposed by the provider). here are the stmt I'm using:
$connstr = 'DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\inetpub\webs\Apache group\Apache2\andrea\db\database.mdb;';
$dbc = new COM("ADODB.Connection");
$dbc->open($connstr);
Then I'm able to select data with following query:
$recs=$dbc->execute("select CLI_ID, CLI_ADDRESS, CLI_NAME from CUSTOMER");
And I'm also able to insert new records:
$recs=$dbc->execute("INSERT INTO CUSTOMER(CLI_ID,CLI_ADDRESS,CLI_NAME) VALUES ('$cli_id','$cli_addr','$cli_nom')");
Regarding this case, I would be able to manage exceptions (errors) that could happen, ie. insert with duplicated primary key.
Now, the web server is issuing an error msg saying there was a duplicated primary key and the record was not inserted: i want to trap this error and do not display it.
Any idea about how to trap such a case? And the same for DELETE (for instance in case of missing records)?
Many thanks in advance for any kind cooperation 🙂)))
Andrea.