extra DataKeyNames - Stored procedure too many arguments ??

Discussion in 'ASP .Net' started by jobs, Nov 30, 2006.

  1. jobs

    jobs Guest

    I have a gridview that I use to both select a record to be edited in a
    formview and to also delete records with. Because the selectcommand is
    grouping rows, my deletes stored procedure requires a different set
    of keys than the one used for the edit.


    The datakeyname in my gridview has a key I need for editing that I do
    not need for deleting. The delete gives me the Procedure or function
    has too many arguments specified error so long as the extra key
    RatePlanId is the datakeynames attribute of the gridview. However, I
    need that rateplanid key to pull the record into a formview when the
    grid row is selected.

    I not sure why it even matters as my delete parameters do not list the
    ... rateplanid key identified.



    <asp:GridView ID="RateGridView" runat="server"
    AutoGenerateColumns="False"
    DataKeyNames="rateplanid,routecode,plancode"
    Width="700px" SkinID="GridView" AllowPaging="True"
    AllowSorting="True" ShowFooter="True"
    PagerSettings-Mode="NumericFirstLast"
    DataSourceID="RateGridSource">
    <EmptyDataTemplate>
    No Data
    </EmptyDataTemplate>
    <Columns>
    <asp:CommandField ButtonType="Image"
    ShowSelectButton="True"
    SelectImageUrl="../App_Themes/WinXP_Silver/Images/edit.gif" />
    <asp:CommandField ButtonType="Image"
    showdeleteButton=true
    deleteImageUrl="../App_Themes/WinXP_Silver/Images/delete.gif" />
    <asp:BoundField DataField="rateplanid" Visible="false"
    />
    <asp:BoundField DataField="ProductCode"
    ItemStyle-Width="25" HeaderText="Product Code"
    SortExpression="ProductCode" />

    .. more code here
    </asp:GridView>


    <asp:SqlDataSource ID="RateGridSource" runat="server"
    ConnectionString="<%$ ConnectionStrings:RTEConnectionString %>"
    OnDeleting="Datasource_ing" OnDeleted="Datasource_ed"
    SelectCommand="Select DISTINCT .. more code here >
    <SelectParameters>
    ... code here
    </SelectParameters>
    <DeleteParameters>
    <asp:parameter Name="RouteCode" Type="String" />
    <asp:parameter Name="Plancode" Type="String" />
    <asp:SessionParameter SessionField="CurrentUser"
    Name="lastUser" Type="String" />
    </DeleteParameters>
    </asp:SqlDataSource>




    I've also tried this:


    <DeleteParameters>
    <asp:ControlParameter ControlID="RateGridView"
    Name="RouteCode" Type="String" />
    <asp:ControlParameter ControlID="RateGridView"
    Name="PlanCode" Type="String" />
    <asp:SessionParameter SessionField="CurrentUser"
    Name="lastUser" Type="String" />
    </DeleteParameters>



    When I remove RatePlanId from the datakeyname the delete works, but my
    edit fails.
    jobs, Nov 30, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike P
    Replies:
    0
    Views:
    3,280
    Mike P
    Jun 19, 2006
  2. Mike
    Replies:
    3
    Views:
    477
  3. David Lozzi
    Replies:
    0
    Views:
    675
    David Lozzi
    Mar 2, 2007
  4. Seth Williams
    Replies:
    1
    Views:
    563
    Seth Williams
    Sep 16, 2008
  5. John Smith

    Procedure or function has too many arguments specified

    John Smith, Jun 29, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    137
    John Smith
    Jun 29, 2005
Loading...

Share This Page