Bug in SqlHelper.UpdateDatase

  • Thread starter Thread starter Luis C. Uribe
  • Start date Start date
L

Luis C. Uribe

The is a bad bug in this method where after updating the DataSet follows
this statement:

dataSet.AcceptChanges()

It is not only unnecessary, it wipes out any pending updates for other
tables.

If one has several tables in the DataSet, after updating the first one the
updates that may follow for the other tables will find nothing to update due
to the above line. Comment it out to avoid the problem.

Luis C. Uribe
 
Since the tablename was passed in as a paramter, how about replacing
dataSet.AcceptChanges() with:

//C#
dataSet.Tables[tableName].AcceptChanges();
'VB
dataSet.Tables(tableName).AcceptChanges()
 
Actually there is no need to do AcceptChanges since it is done
automatically by update. The fix is just to comment the AcceptChanges
statement.

Luis


Jim Hughes said:
Since the tablename was passed in as a paramter, how about replacing
dataSet.AcceptChanges() with:

//C#
dataSet.Tables[tableName].AcceptChanges();
'VB
dataSet.Tables(tableName).AcceptChanges()

Luis C. Uribe said:
The is a bad bug in this method where after updating the DataSet follows
this statement:

dataSet.AcceptChanges()

It is not only unnecessary, it wipes out any pending updates for other
tables.

If one has several tables in the DataSet, after updating the first one the
updates that may follow for the other tables will find nothing to
update
due
to the above line. Comment it out to avoid the problem.

Luis C. Uribe
 
Back
Top