Error Trapping dataAdapter.update

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a data grid that keeps changes on a post back but does not persist the
changes to the underlying database. I dropped a sqlconnection and
sqldataadpater control at design time on to an ASP.NET page.
Here is my code:

Try
dataAdapter.Update(dataSet, "table")
Catch ex as sqlException
sError = ex.Message
End Try

Stepping through the code does not generate any errors. How can I find out
the reason the data does not save to the database? Any suggestions will be
appreciated.

Dan
 
Hi,

DLS said:
I have a data grid that keeps changes on a post back but does not persist
the
changes to the underlying database. I dropped a sqlconnection and
sqldataadpater control at design time on to an ASP.NET page.
Here is my code:

Try
dataAdapter.Update(dataSet, "table")
Catch ex as sqlException
sError = ex.Message
End Try

Stepping through the code does not generate any errors. How can I find out
the reason the data does not save to the database? Any suggestions will be
appreciated.

It is probably your table that doesn't have any suitable rows for update
(RowState == DataRowState.Unchanged).
You might try looking at dataSet.GetChanges() - it returns you all rows that
are pending update.
 
Back
Top