存储过程参数计数在C#中自动增加 [英] Stored procedure parameter count increases automatically in C#

查看:107
本文介绍了存储过程参数计数在C#中自动增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个存储过程用于删除记录,一个用于插入记录。



这是因为回滚目的。





 sp_existDelete 
sp_RestoreAgain


cmdTempRemove.Parameters.Add(< span class =code-string> @ seats,SqlDbType.Int).Value = 23 ;

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



以上两个是存储过程。



第一个将删除记录。



然后第二个将通过插入值恢复。



当我再次删除记录时。我得到一个结果。



存储过程指定了太多参数。



我只使用一个参数。



为什么我收到此错误。



请求帮助

解决方案

指定的参数太多的错误只能意味着。在某处您添加了太多参数。



由于您没有显示所有相关代码,我们无法向您指出。也许你有一个循环,你需要再次添加它之前调用cmdRestore.Parameters.Clear。



你需要调试,看看发生了什么

I have two stored procedure one to delete a record and one to insert record.

This is because to roll back purpose.


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

解决方案

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.


这篇关于存储过程参数计数在C#中自动增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆