Click here to Skip to main content
15,899,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
0 down vote favorite


I'm working on a web application using asp.net on my gridview im using a command field edit button that calls a stored procedure for updating the data but while updating

I'm getting the following error:

Procedure or function updateprofile has too many arguments specified.

Description:
An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it
originated in the code.

Exception Details:
System.Data.SqlClient.SqlException: Procedure or function updateprofile has too many
arguments specified.

This is my stored procedure:
SQL
ALTER procedure [dbo].[updateprofile] 
   @pid int, 
   @pfirstname varchar(50), 
   @plastname varchar(50), 
   @padress varchar(50),
   @pemail varchar(50),
   @ptelephone varchar(50), 
   @pbirthday date 
as begin 
   update profile 
   set firstname = @pfirstname, @plastname = lastname,
       @padress = adress, @pemail = email, @ptelephone = telephone,
       birthday = @pbirthday 
   where id = @pid end


And this is my asp code:

C#
SelectCommand="selectAllProfile" SelectCommandType="StoredProcedure"     
UpdateCommand="updateprofile" UpdateCommandType="StoredProcedure"
DeleteCommand="deleteprofile" DeleteCommandType="StoredProcedure"

<updateparameters>
  <asp:Parameter Name="pid" Type="Int32" />
  <asp:Parameter Name="pfirstname" Type="String" /> 
  <asp:Parameter Name="plastname" Type="String" />
  <asp:Parameter Name="padress" Type="String" /> 
  <asp:Parameter Name="pemail" Type="String" /> 
  <asp:Parameter Name="ptelephone" Type="String" /> 
  <asp:Parameter DbType="Date" Name="pbirthday" /> 
</updateparameters>

btw im facing the same error for the delete command

Awaiting your reply

Your help is much appreciated :)
Posted
Updated 18-Aug-13 23:47pm
v2
Comments
ArunRajendra 19-Aug-13 5:53am    
First check if you can execute the stored procedure directly.

Just an observation, and this could be because you typed this? But the following:
SQL
firstname = @pfirstname, @plastname = lastname,
       @padress = adress, @pemail = email, @ptelephone = telephone,
       birthday = @pbirthday

should that not be:
SQL
firstname = @pfirstname, lastname = @plastname,
       adress = @padress, email = @pemail, telephone = @ptelephone,
       birthday = @pbirthday
 
Share this answer
 
i've fixed it and i'm still getting the same error !
 
Share this answer
 
the stored procedure is working perfectly
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900