none
Query is corrupt RRS feed

  • Question

  • This message is a new one to me.

            Public Sub IncrementEventID()
                'Increment ID number and assign to global variable
                Dim strEventID As String = CStr(_strEventMasterID)
                Dim intEventID As Integer = CInt(Mid(strEventID, 3, 8))
                intEventID += 1
                strEventID = "EV" + CStr(intEventID)
                Try
                    'Open Connection and establish Command object
                    FileIDConn.MasterBaseOpen()
                    Dim FileIDTable As DataTable = New DataTable
                    FileIDCommand = New OleDbCommand("Select chrEventID From setEventID", FileIDConn.MasterBaseConnection)
                    FileIDAdapter = New OleDbDataAdapter()
                    FileIDAdapter.SelectCommand = FileIDCommand
                    Dim FileIDBuild As OleDbCommandBuilder = New OleDbCommandBuilder(FileIDAdapter)
                    FileIDAdapter.Fill(FileIDTable)
                    'Replace ChangeID value in table
                    FileIDBindingSource.DataSource = FileIDTable
                    FileIDTable.Rows(0).Item(0) = CStr(strEventID)
                    FileIDBindingSource.EndEdit()
                    FileIDAdapter.Update(FileIDTable)
                    FileIDConn.MasterBaseClose()
                    FileIDCommand.Dispose()
                    FileIDAdapter.Dispose()
                    FileIDTable.Dispose()
                Catch ex As Exception
                    MessageBox.Show("Failed to update Event ID." + ControlChars.CrLf + ex.Message, "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Exit Sub
                End Try
            End Sub

    The exeception is executed at the FileIDTable.Update() line.  My understanding of the error message is that there is something wrong in query contained in FileIDCommand.

    While this is probably very obvious, I just don't get it.

    Oh yeah, I use this code to increment an ID number.


    gwboolean


    • Edited by gwboolean Friday, December 13, 2019 6:50 PM
    Friday, December 13, 2019 6:49 PM

All replies

  • Check out the following post

    https://social.msdn.microsoft.com/Forums/en-US/533b7f8b-9b08-4ff7-aad0-2978fb21009e/microsoft-access-8211-bug-8211-error-3340-8211-query-is-corrupt?forum=vbgeneral


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, December 13, 2019 7:09 PM
    Moderator
  • Karen,

    I reviewed the information you suggested and noted that the build that I have is much later than the one in the article.  From what I read, this is an Access problem and should, hopefully, be resolved soon.

    Is that correct?

    I am only using Access as I am working on the application I am building.  After I near completion I will be using SQL instead of Access.


    gwboolean

    Friday, December 13, 2019 7:34 PM
  • Karen,

    I reviewed the information you suggested and noted that the build that I have is much later than the one in the article.  From what I read, this is an Access problem and should, hopefully, be resolved soon.

    Is that correct?

    I am only using Access as I am working on the application I am building.  After I near completion I will be using SQL instead of Access.


    gwboolean

    I have not been following the progress for this issue so I can't say but have not seen anyone with this issues for several weeks now. 

    Personally I don't use MS-Access in over 10 years but did just ran an old app using the Office 365 with all the latest updates and had zero issues.



    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, December 13, 2019 7:41 PM
    Moderator
  • More likely that I am doing some unknown thing, to me, wrong then it being a bug.

    I will give it awhile and if it does not self correct I will look at another way to get the job done (even though I have been using this method to increment stored IDs).

    My method is probably no where near the best approach anyway.  I will add that to my overwhelmingly voluminous list of things that need to be done.


    gwboolean

    Friday, December 13, 2019 7:46 PM
  • Did you check if assigning the corresponding UPDATE statement to FileIDAdapter.UpdateCommand is required in order to make it work (https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbdataadapter.updatecommand)?


    • Edited by Viorel_MVP Friday, December 13, 2019 7:54 PM
    Friday, December 13, 2019 7:51 PM
  • Hi gwboolean, 

    Thank you for posting here.

    I use Access database to make a test based on your code, but I get no exception, so the problem may related to Access database.

    I find two related references about the exception.

    1. Access error: "Query is corrupt"
    2. Query Corrupt Ms Access

    Besides, if suggestions in references cannot help you resolve the issue, please provide more information about the design of your database and more details about ‘FileIDTable.Update()’ which didn’t exist in the code you provide.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 16, 2019 3:15 AM
    Moderator