none
Errors using OleDB to update DBASE table RRS feed

  • Question

  • Hi,

    I am trying to do a simple update to a DBASE IV table and am getting the "Operation must use an updateable query" error.  Here's the code:

        Dim CMConn As OleDb.OleDbConnection, CMCmd As OleDb.OleDbCommand
        Dim Sql As String

        CMConn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\MainServer\Payroll\2009;" & _
                                           "Extended Properties=dBase IV")
        CMConn.Open()
        Sql = "UPDATE EMPMASTER SET VACHOURS = 40 WHERE EMPNUM = '011'"
        CMCmd = New System.Data.OleDb.OleDbCommand(Sql, CMConn)
        CMCmd.ExecuteNonQuery()

    The error occurs on the ExecuteNonQuery.  Any ideas what I'm doing wrong?

    Thanks,

    Dave

    • Moved by eryang Monday, September 14, 2009 3:02 AM (From:.NET Base Class Library)
    Thursday, September 10, 2009 11:57 PM

Answers

  • Hello,dcline97
    normall,this error will occur when you dont have enough rights (write) to access the Access Database

    To solve this problem,please set the current winform user full rights of the *.mdb file
    and if it is an IIS application,then you should give ASPNET user at least Read,Write,List Rights.

    Wenn ich dich hab’,gibt es nichts, was unerträglich ist.坚持不懈!http://hi.baidu.com/1987raymond
    • Marked as answer by Yichun_Feng Thursday, September 17, 2009 2:31 AM
    Monday, September 14, 2009 3:10 AM
  • Since it looks like the database is located on a network resource I would make certain that the user of application has full permissions to the folder where the database is located.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by Yichun_Feng Thursday, September 17, 2009 2:32 AM
    Tuesday, September 15, 2009 1:02 PM

All replies

  • Please make sure you or your prgram have enough privilege on the database operation, especially IIS program.
    Friday, September 11, 2009 7:05 AM
  • Hello,dcline97
    normall,this error will occur when you dont have enough rights (write) to access the Access Database

    To solve this problem,please set the current winform user full rights of the *.mdb file
    and if it is an IIS application,then you should give ASPNET user at least Read,Write,List Rights.

    Wenn ich dich hab’,gibt es nichts, was unerträglich ist.坚持不懈!http://hi.baidu.com/1987raymond
    • Marked as answer by Yichun_Feng Thursday, September 17, 2009 2:31 AM
    Monday, September 14, 2009 3:10 AM
  • Since it looks like the database is located on a network resource I would make certain that the user of application has full permissions to the folder where the database is located.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by Yichun_Feng Thursday, September 17, 2009 2:32 AM
    Tuesday, September 15, 2009 1:02 PM
  • I have domain admin rights so I don't think its a file persmissions issue.  I can update the files just fine in MS Access, just not using  the codes I have shown above.  Any other ideas?
    Monday, September 21, 2009 4:12 PM
  • Is empnum the primary key for empmaster? Sounds like the execute cannot distinguish which record you want to update.


    Formerly MichaelTx
    Monday, September 21, 2009 4:30 PM
  • It's rather odd that you can update from Access but not from the query when using Jet OLEDB and the dBase ISAM driver. I know that Access will request that you specify a primary key if there isn't one defined in your dBase database when linking the table. Could it be that your dBase database does not have a primary key?

    I would also make certain that you're using the latest version of Jet 4.0.

    http://support.microsoft.com/kb/230125/EN-US/


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, September 21, 2009 8:29 PM