www.webdeveloper.com
Results 1 to 1 of 1

Thread: [SOLVED]Query through ODBC MS Access

  1. #1
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428

    Question [SOLVED]Query through ODBC MS Access

    I am trying to connect a MS Access DB, using php via ODBC. The first step: grabbing data from the MDB works great - I can get data and echo it.

    Now I want to update a table in the DB, but I get an error:

    "PHP Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in... file/line"

    I have checked whether the mdb file is read-only. No, it is not. I have changed all the security file properties to "Full access", thus I don't think this is the problem.

    Here's the code I have used:
    PHP Code:
    <? 
    $conn
    =odbc_connect('mycontent','','');
    if (!
    $conn)
      {exit(
    "Connection Failed: " $conn);}
    $sql="UPDATE CV_Pers SET CV_Technique='foo' WHERE CV_Nom='Anghel Monica'";
    odbc_exec($conn,$sql);
    odbc_close($conn);
    ?>
    Where:
    mycontent - DSN name
    CV_Pers - the table's name
    CV_Technique - a column header name
    CV_Nom - another column header name

    As I said, all these worked OK when I had to retrieve data from DB. But the above code failed when trying to write something on the DB.

    I am not quite an ace in php nor ODBC . Do you have any idea, please?

    --------
    Solved. The syntax is ok. Except that the chief programmer forgot to specify the full rights when he set the ODBC
    Last edited by Kor; 04-13-2009 at 08:21 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles