|
-
Feb 3rd, 2010, 04:44 PM
#1
Thread Starter
New Member
[RESOLVED] How to display initial value when TableAdapterManager.UpdateAll() fail ?
Hello all
I've been scratching my head since 2 days on this problem but can't find any solution.
Take a very simple WinForm project, drop a DataGridView bound to an access database on the form. Some code (Form_Load, and navigatorsaveitem_click) is generated also with the usual TableAdapter, bindingsource, TableAdapterManager and the dataset.
My problem is the following :
- A user is editing a cell value
- the network becomes unavailable
- when the user clicks the NAvigator save button, an exception is thrown during TableAdapterManager.UpdateAll(Me.theDataSet) method. This exception states that the database.mdb file is unreachable.
Until now, that's OK.
What I would like to do is to display in the datagridview, the previous value, that is to say the original value, not the modified one, in order to let the user choose to retry the editing or quit the application.
I've set the TableAdapterManager.BackupDatasetBeforeUpdate to true, with no result. I've tried to call bindingsource.resetbindings or resetcurrentitem, but can not find any solution.
Is it possible to achieve this behavior using a DataGridView, its binding, the dataset, or tableadapter, or should I backup myself the initial values of the edited row in order to retrieve them when exception occurs ?
Thanks in advance.
Manu
-
Feb 4th, 2010, 06:17 AM
#2
Thread Starter
New Member
Re: How to display initial value when TableAdapterManager.UpdateAll() fail ?
The solution is to simply call DataSet.RejectChanges()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|