Geeks With Blogs
Mayank Sharma

This error took me a while to figure out. I was using SqlDataSource with stored procedures for SELECT and UPDATE commands. The SELECT worked fine. Then I added UPDATE command and while trying to update, I would get this error:

"Procedure of function has too many arguments specified"

Apparently, good guys at .NET decided it is necessary to send SELECT parameters with the UPDATE command as well. So when I was sending the required parameters to the UPDATE sp, in reality, it was also getting my SELECT parameters, and thus failing.

I had to add the extra parameters in the UPDATE stored procedure and make them NULLABLE so that they are not required....phew...

Here is piece of SP with unused parameters.

ALTER PROCEDURE [dbo].[UpdateMaintenanceRecord]
       @RecordID INT
    ,@District VARCHAR(255)
    ,@Location VARCHAR(255)
   
    --UNUSED PARAMETERS
    ,@MTBillTo VARCHAR(255) = NULL
    ,@SerialNumber VARCHAR(255) = NULL
    ,@PartNumber VARCHAR(255) = NULL

Update: I was getting that error because unkowingly, I had bound the extra fields in my GridVeiw with Bind() call. I changed all the extra one's, which did not need to be in Update, to Eval() and everything works fine.

Posted on Friday, May 7, 2010 9:35 AM ASP.NET , SQL | Back to top


Comments on this post: Procedure or function has too many arguments specified

# re: Procedure or function has too many arguments specified
Requesting Gravatar...
Hi there,

I am having the same issue... How do you change the columns to .Eval() Is it done programatically or can it be done via the designer?

Kind regards,
Bren
Left by Brenden on Sep 07, 2011 4:31 AM

# re: Procedure or function has too many arguments specified
Requesting Gravatar...
You can do it in html designer. Here's an overview: http://msdn.microsoft.com/en-us/library/ms178366.aspx
Left by Max on Sep 07, 2011 5:48 AM

# re: Procedure or function has too many arguments specified
Requesting Gravatar...
Procedure or function spUpdateDomain has too many arguments specified.
i am creating the windows application software this problem is create please tell me this problem.
Left by Brijesh kumar on Apr 03, 2013 2:45 AM

Your comment:
 (will show your gravatar)


Copyright © bullpit | Powered by: GeeksWithBlogs.net