Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Procedure has too many arguments 1

Status
Not open for further replies.

dpdoug

Programmer
Nov 27, 2002
455
US
I have a stored procedure that has an insert query with exactly 14 parameters and exactly 14 fields. (counted them several times)

In a function I have exactly 14 Sqlparameters (counted them several times also) with an ExecuteNonQuery method.

The parameters and the method are inside a loop that iterates as many times as the DataSet that sets the values of the parameters.

What happens is that it goes throught the loop one time and successfully inserts the first row of the DataSet and then jumps out with an error message:

Code:
Procedure or function Insert_Table1 has too many arguments specified.

It also fails to insert a value of one of the fields that I know for sure has data and is the correct element in the DataSet. The field name is correct in the procedure as well as the parammeter and the datatype and size is also correct
 
I know you've said that you have counted them several times but the error suggests that there have been two many parameters given. I would try removing all the parameters and adding them one at a time, running the insert and seeing if it works. If it does add another parameter and carry on.

It can be very annoying when working with multiple arguments (as you've said you have counted them and all appears to be fine) so it's best to work from the start.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
post your code...I have a feeling you add the parameters to the command in the loop, but declare the command outside of the loop...so the second run it has 28 parameters.

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Yes. This was exactly the problem. I put the loop outside the function instead and now it works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top