Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two stored procedure one to delete a record and one to insert record.

This is because to roll back purpose.


C#
sp_existDelete
sp_RestoreAgain


cmdTempRemove.Parameters.Add("@seats", SqlDbType.Int).Value = 23;

cmdRestore.Parameters.Add("@seats", SqlDbType.Int).Value = 23;

The above two are stored procedures.

The first one will erase the record.

Then the second one will restore by inserting the values.

When I delete the record again. I get a result.

Stored procedure has too many arguments specified.

I just use one parameter.

Why I am getting this error.

Pleas help
Posted
Comments
CHill60 13-Jun-14 8:29am    
We'd need to see how you have defined your stored procedures and also how you are handling these command objects.
KUMAR619 16-Jun-14 3:55am    
I have rectified my mistake.
My mistake was that I didn't Clear the parameters for stored procedure.
Thanks for involving

1 solution

The error about too many arguments specified can only mean that. Somewhere you are adding too many parameters.

Since you haven't shown all the relevant code we can't point it out to you. Perhaps you have this in a loop and you need to call cmdRestore.Parameters.Clear before you add it again.

You'll need to debug and see what is happening.
 
Share this answer
 
Comments
Mike Meinz 13-Jun-14 9:54am    
+5
Exactly what I was thinking! He is not executing a cmdRestore.Parameters.Clear.
KUMAR619 16-Jun-14 3:53am    
Thanks RyanDev.
It was the mistake which I did.
ZurdoDev 16-Jun-14 7:11am    
Good to hear.

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