extra DataKeyNames - Stored procedure too many arguments ??

J

jobs

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top