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

Re: Error Trapping dataAdapter.update by Miha

Miha
Wed Jun 29 03:36:14 CDT 2005

Hi,

"DLS" <DLS@discussions.microsoft.com> wrote in message
news:449F28BD-F3C6-40EB-803B-5DCFDF1BCABB@microsoft.com...
>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.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info