Updating objectdatasources with strongly typed datasets

Last post 10-31-2005 3:12 PM by wsyeager. 3 replies.

Sort Posts:

  • Updating objectdatasources with strongly typed datasets

    11-21-2004, 6:04 PM
    • Loading...
    • raquila
    • Joined on 11-21-2004, 5:50 PM
    • Posts 3
    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.
  • Re: Updating objectdatasources with strongly typed datasets

    11-23-2004, 11:20 PM
    • Loading...
    • raquila
    • Joined on 11-21-2004, 5:50 PM
    • Posts 3

    Edited by SomeNewKid. Please post code between <code> and </code> tags.



    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>

  • Re: Updating objectdatasources with strongly typed datasets

    11-29-2004, 12:07 AM
    • Loading...
    • raquila
    • Joined on 11-21-2004, 5:50 PM
    • Posts 3
    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
  • Re: Updating objectdatasources with strongly typed datasets

    10-31-2005, 3:12 PM
    • Loading...
    • wsyeager
    • Joined on 06-26-2002, 3:42 PM
    • Weston, Florida, USA
    • Posts 455
    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?
    Thanks,

    Bill Yeager MCP.Net, BCIP
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter