Could not complete cursor operation because the table schema changed after the cursor was declared error when adding records

Unanswered Could not complete cursor operation because the table schema changed after the cursor was declared error when adding records

  • Friday, August 03, 2012 3:52 PM
     
     

    We are receiving this error when adding records (see code below). The error occurs only occasionally. There are no changes being made to the database schema. The program is in vb6 with sql2008r2. This code runs on hundreds of other systems with no errors (The error occurs at line 1090):

        If DetRecs.state = adStateOpen Then Set DetRecs = Nothing
        gDBCmd.CommandText = "Select * From TikDet Where 1 = 2 "
        DetRecs.Open gDBCmd, , adOpenForwardOnly, adLockOptimistic
    1000
        For I = 1 To UBound(DetArray, 2)
    1010    If DetArray(mitikctr, I, 1) = 0 Then Exit For
            DetTotalUp = 0
            With DetRecs
    1020    .AddNew
                !tikdetcomp = miComp
                !TikDetStore = miStore
                !TikDetTikNum = miTikNum(mitikctr)
    1090    .Update

All Replies

  • Friday, August 03, 2012 6:14 PM
     
     

    Are you making any changes in the table within the cursor?


    Please click the Mark as Answer or Vote As Helpful button if a post solves your problem or is helpful!