objectdatasource.update() fires System.InvalidOperationException

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

Guest

hello,
we have a strage error message here:

I've written a small detail sample page, where I can update one reocrd with
an objectdatasource control and the detailsview control.
the objectdatasource.confictdetection is set to 'CompareAllValues'. The
Updatemethod is UpdateXY and I've set two updateparameters classX and
original_callsX.

when I use the update link provided by the detailsview control, everything
works as expected.

The problem comes now:
I added a button on the page and labeled it 'Update'. In the clicked event I
added the code objectdatasource1.Update().
Here the following exception is fired immediatelly:
You have specified that your update method compares all values on
ObjectDataSource 'odsCommodity', but the dictionary passed in for oldValues
is empty. Pass in a valid dictionary for update or change your mode to
OverwriteChanges.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidOperationException: You have specified that
your update method compares all values on ObjectDataSource 'odsCommodity',
but the dictionary passed in for oldValues is empty. Pass in a valid
dictionary for update or change your mode to OverwriteChanges.

You have specified that your update method compares all values on
ObjectDataSource 'odsCommodity', but the dictionary passed in for oldValues
is empty. Pass in a valid dictionary for update or change your mode to
OverwriteChanges.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidOperationException: You have specified that
your update method compares all values on ObjectDataSource 'odsCommodity',
but the dictionary passed in for oldValues is empty. Pass in a valid
dictionary for update or change your mode to OverwriteChanges.

Stack Trace:


[InvalidOperationException: You have specified that your update method
compares all values on ObjectDataSource 'odsCommodity', but the dictionary
passed in for oldValues is empty. Pass in a valid dictionary for update or
change your mode to OverwriteChanges.]
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary
keys, IDictionary values, IDictionary oldValues) +703
System.Web.UI.WebControls.ObjectDataSourceView.Update(IDictionary keys,
IDictionary values, IDictionary oldValues) +37
System.Web.UI.WebControls.ObjectDataSource.Update() +42
CommodityDetail.btnUpdate_Click(Object sender, EventArgs e) in
c:\Application\vs2005\Sample2_ObjectDataSource_IEnum\UserInterface\CommodityDetail.aspx.cs:19
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +96
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+116

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838


Any help?
Thanks in advance
Markus
 
Hi Markus,

We will reply to you on another thread in
microsoft.public.dotnet.framework.aspnet.webcontrols newsgroup. Please go
there and get the reply. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top