473,662 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="RateGridVie w" runat="server"
AutoGenerateCol umns="False"
DataKeyNames="r ateplanid,route code,plancode"
Width="700px" SkinID="GridVie w" AllowPaging="Tr ue"
AllowSorting="T rue" ShowFooter="Tru e"
PagerSettings-Mode="NumericFi rstLast"
DataSourceID="R ateGridSource">
<EmptyDataTempl ate>
No Data
</EmptyDataTempla te>
<Columns>
<asp:CommandFie ld ButtonType="Ima ge"
ShowSelectButto n="True"
SelectImageUrl= "../App_Themes/WinXP_Silver/Images/edit.gif" />
<asp:CommandFie ld ButtonType="Ima ge"
showdeleteButto n=true
deleteImageUrl= "../App_Themes/WinXP_Silver/Images/delete.gif" />
<asp:BoundFie ld DataField="rate planid" Visible="false"
/>
<asp:BoundFie ld DataField="Prod uctCode"
ItemStyle-Width="25" HeaderText="Pro duct Code"
SortExpression= "ProductCod e" />

.. more code here
</asp:GridView>
<asp:SqlDataSou rce ID="RateGridSou rce" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:RTEConnectio nString %>"
OnDeleting="Dat asource_ing" OnDeleted="Data source_ed"
SelectCommand=" Select DISTINCT .. more code here >
<SelectParamete rs>
... code here
</SelectParameter s>
<DeleteParamete rs>
<asp:Paramete r Name="RouteCode " Type="String" />
<asp:Paramete r Name="Plancode" Type="String" />
<asp:SessionPar ameter SessionField="C urrentUser"
Name="lastUser" Type="String" />
</DeleteParameter s>
</asp:SqlDataSour ce>


I've also tried this:
<DeleteParamete rs>
<asp:ControlPar ameter ControlID="Rate GridView"
Name="RouteCode " Type="String" />
<asp:ControlPar ameter ControlID="Rate GridView"
Name="PlanCode" Type="String" />
<asp:SessionPar ameter SessionField="C urrentUser"
Name="lastUser" Type="String" />
</DeleteParameter s>

When I remove RatePlanId from the datakeyname the delete works, but my
edit fails.

Nov 30 '06 #1
0 1516

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

Similar topics

3
1764
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 AddCompany to insert the company name from the Company Name textbox into the COMPANY table and return the @@IDENTITY of the company name just input into the database back to a label on the form. THIS IS WORKING.
3
1654
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 specified." Here is my SP: ALTER PROCEDURE dbo.UpdateDetails @KeyID int
1
1366
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 and they match. I compared the type of the parameters and they match. I then made sure that everything I wasn't inserting allowed nulls. The error persists. What else could this be? Code and SP below. Its possible that I am stupid and...
3
2480
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 performed BIND operation. When click on Debug menu and enter the Input parameters for the stored procedure ,
3
6399
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 sqldatasource. Conflictdetection set to compareallvalues. Oldvaluesparameterformatstring set to original_{0} tblA has 2 fields. ID and MyText. Deletecommand="Delete from tblA where ID=@original_ID"
0
1486
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 getting the error 'Procedure or function <stored procedure name> has too many arguments specified'. Has anybody else come across this, and if so how do you prevent this annoying error?
1
2633
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="<%$ ConnectionStrings:stellentConnectionString %>" SelectCommand="spWC_Adjusters" SelectCommandType="StoredProcedure" InsertCommand="spWC_Adjusters_Insert " InsertCommandType="StoredProcedure" UpdateCommand="spWC_Adjusters_Update"
3
5152
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 sqldatasource control, there is no need of opening and closing a connection. Also there is no need to write connection string. When i am selecting table from sqldatasource and writing insert statement in C# code, its working fine. When I am...
0
3177
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 fine. Now we decided to move from mainframe IMS-DB2 to Windows 2003 server-DB2 UDB for LUW 9.5.
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.