[dba-VS] Problem saving data in an Access database

Charles Wolfe cawolfe at verizon.net
Mon Apr 27 01:28:03 CDT 2015


Hi All,
I'm using VB.Net 2003 and an ACCESS backend.  This description may have more information than is needed to answer my question. 

I have a Windows form that extracts a subset of rows from a "specimen" details table and then attempts to save that subset of rows under a new key. This comes about because researchers sometimes digitize multiple structures as a complex whole then later want to extract one of the component structures and analyze it by itself. This creates a new "specimen" or "case".  These are all defined as part of a Project database. There are multiple databases, one per project. The program keeps track of the projects and their disk locations.

The program has no problem saving the attributes of this new case to an attributes table or adding this new specimen to its "group"or "sample"  table. However, when it is time to save the new set of inserted rows contained in a data table of identical structure to the one the rows should be added to, it does not save any of the new rows in the specimen details table. 

Any and all ideas are welcome. I've been looking at this off and on for 2 weeks and have had no luck. There is no problem adding rows thru other operations that perform similar manipulations of the digitized data. All the additions to the digitized data table go thru the same worker class's code so it is not a coding error on this one form. I've had the worker class routine "dump" the temporary table's rows to a log file, and it shows they are all there.

Here is the code with unrelated details omitted. Always gives the message: Specimen KEYVALUE: 0 Rows Inserted/Added. This implies it know there are rows to add, but does not add them. Otherwise, the message would be "No Rows To Insert/Add. It never throws an exception and I have no idea as to what happened to the rows. Looking at the table shows that they are not in the table..

      UpdatedRows = SpecimenDataSet.GetChanges(DataRowState.Modified)
      InsertedRows = SpecimenDataSet.GetChanges(DataRowState.Added)
      DeletedRows = SpecimenDataSet.GetChanges(DataRowState.Deleted)
      digitizedDA.ContinueUpdateOnError = True
    
      Try
           If (Not (InsertedRows) Is Nothing) Then   'Insert the new rows
                numpts = digitizedDA.Update(InsertedRows, MyDatTable)
                MLmetricsLog.WriteLog("[cls_SpecimenSaveDetail   ] >> Specimen  " &                         g_lngActiveSpecimenKey.ToString & _
                         ": " & numpts.ToString & " Rows Inserted/Added.")
         Else
               MLmetricsLog.WriteLog("[cls_SpecimenSaveDetail   ] >> Specimen  " &                     g_lngActiveSpecimenKey.ToString & _
                     ": There were No Rows To Insert/Add.")
            numpts = -1      'Need some value to show "error"
         End If
    Catch ex as exception        (Error handler code)
   End Try
Again, all ideas, suggestions welcome.
Charles Wolfe


More information about the dba-VS mailing list