locked
Updating objectdatasources with strongly typed datasets RRS feed

  • Question

  • User1088810913 posted
    Ok, I have a simple webservice that has two functions, public EventDataSet GetEvent( int eventId ) and public EventDataSet UpdateEvents( EventDataSet events ). I have created an objectdatasource that uses the GetEvent function as the select function and the UpdateEvents as the update and insert function. I also have a formview control which I hookup to this objectdatasource. I have no problems get an event and displaying it in the formview control. The problem is when I try to update the data I get errors. The error I get is Cannot change the name of the DataSet to an empty string. I have also tried to override the ItemUpdating function to see what FormViewUpdateEventArgs.NewValues look like and they have the orginal values that were pulled from the GetEvent function instead of the newly typed in values. I would expect them to be updated at this point. Has anyone had this type of problem. I have also tried replacing the formview with a detailsview control and I have the same problems.
    Sunday, November 21, 2004 6:04 PM

All replies

  • User1088810913 posted
    <color="#6633cc">Edited by SomeNewKid. Please post code between </color><color="#000000"><</color>code><color="#6633cc"> and </color><color="#000000"><</color>/code><color="#6633cc"> tags.</color>
    I believe the problem may lie in how the designer created the objectdatasource properties. I have pasted what was created by the designer after I configured the data source and set the insert, update, and add functions. Base on these settings, I’m not so sure how the update command would be able to create a strongly typed dataset. I’m also not sure why so many update and insert parameters were created. Does anyone know if these parameters were created correctly? <asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="dev.WebService" InsertMethod="UpdateEvents" SelectMethod="GetEvents" UpdateMethod="UpdateEvents" DataObjectTypeName="dev.EventDataSet"> <UpdateParameters> <asp:Parameter Type="Boolean" Name="EnforceConstraints"></asp:Parameter> <asp:Parameter Name="RemotingFormat"></asp:Parameter> <asp:Parameter Type="Boolean" Name="CaseSensitive"></asp:Parameter> <asp:Parameter Type="String" Name="DataSetName"></asp:Parameter> <asp:Parameter Type="String" Name="Namespace"></asp:Parameter> <asp:Parameter Type="String" Name="Prefix"></asp:Parameter> <asp:Parameter Name="Locale"></asp:Parameter> <asp:Parameter Name="Site"></asp:Parameter> </UpdateParameters> <SelectParameters> <asp:Parameter Type="Int32" DefaultValue="5" Name="eventId"></asp:Parameter> </SelectParameters> <InsertParameters> <asp:Parameter Type="Boolean" Name="EnforceConstraints"></asp:Parameter> <asp:Parameter Name="RemotingFormat"></asp:Parameter> <asp:Parameter Type="Boolean" Name="CaseSensitive"></asp:Parameter> <asp:Parameter Type="String" Name="DataSetName"></asp:Parameter> <asp:Parameter Type="String" Name="Namespace"></asp:Parameter> <asp:Parameter Type="String" Name="Prefix"></asp:Parameter> <asp:Parameter Name="Locale"></asp:Parameter> <asp:Parameter Name="Site"></asp:Parameter> </InsertParameters> </asp:ObjectDataSource></asp:Content>
    Tuesday, November 23, 2004 11:20 PM
  • User1088810913 posted
    If anyone is interested I have posted a sample project that produces the error I get here: http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=92dd7d9e-9a4c-4938-b155-7dee5a52a51b
    Monday, November 29, 2004 12:07 AM
  • User1520651007 posted
    raquila, take a look at this post: http://forums.asp.net/1048212/ShowPost.aspx

    It's impossible to use the INSERT, UPDATE or DELETE methods assoicated with an ObjectDataSource with strongly typed datasets primarily because of the simple following reason:

    "A workaround for this problem could be if there was any way to make the strong-typed dataset generator (Built into VSNET 2005) to include a default constructor for the strong-typed DataRow class that is generated with the dataset." - this was included in another post I found.

    You have to have the default consturctor in the typed Dataset class that the ObjectDatasource requires, or else it can't work. Is this going to be fixed with the RTM version of VS2005?
    Monday, October 31, 2005 3:12 PM
  • User2135110853 posted

    Am I understanding this correctly? Are you basically saying that the tutorials offered here for how to build a Business Logic Layer (BLL) are essentially WRONG, and THAT'S why I've lost two weeks of development time!?! All this time, I thought there must be some subtle syntactical difference with how it's done if you are using MySQL instead of SQL Server (besides that parameters use '?' instead of '@'). Well, then how ARE you supposed to build a working BLL that would be used from an ObjectDataSource, or is the lesson here to not use ObjectDataSource? (and that can't be it either since the BLL itself is generating errors, even though I followed the tutorial to a T.)

     Does anyone know how to make a working BLL (specifically Update and Insert) using MySQL 5.1 in Visual Studio 2005?

    Tuesday, January 27, 2009 6:22 PM