473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

extra DataKeyNames - Stored procedure too many arguments ??

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.

Nov 30 '06 #1
0 1495

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bilbo | last post by:
I have a a headscratcher here: I have a form that when submitted should do 2 things when a user enters data and then clicks the Add button. Here goes: 1. Call a stored procedure called...
3
by: Justin | last post by:
I am trying to do a simple update of a database using a stored procedure. I have get the following error when executing the code: "Procedure or function UpdateDetails has too many arguments...
1
by: Child | last post by:
Hi, I am getting the error: "Procedure or function spAddActivity has too many arguments specified. " on a stored procedure insert. I compared the number of parameters in the function and the SP...
3
by: nikhilbhavsar | last post by:
Hi Frnds , I want to debug a stored procedure. It is written in SQL. I am using Developement center for creating stored procedures. I built the stored procedure with Debug option and also...
3
by: Jim Andersen | last post by:
Just to let you know, and to help any future sorry sods who gets trapped in the same black hole...... You can't just copy/move a working sql-statement into a stored procedure. Working with a...
0
by: Mike P | last post by:
I am using a SqlDataSource with a GridView and stored proc, and I have specified exactly the same update parameters for the SqlDataSource in exactly the same order as my stored proc. Yet I keep...
1
by: jkeel | last post by:
If I try to Update a record with the following code using a stored procedure I get an error: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$...
3
by: mahajanvit | last post by:
Hi one and all I got this problem during my project. So in order to solve this I made a very small application. I am trying to insert using SP and sqldatasource control. I know that while using...
0
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.