ALTER PROCEDURE VendorsRowcount
@RowCount int OUTPUT
AS
SET NOCOUNT ON
SELECT *
FROM dbo.Vendors
SET @RowCount = @@ROWCOUNT
RETURN @RowCount
C#:
using (var conn = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Pricer;Persist Security Info=True;User ID=xxx;Password=xxx"))
using (var command = new SqlCommand("VendorsRowcount", conn)
{
CommandType = CommandType.StoredProcedure
})
{
conn.Open();
command.ExecuteNonQuery();
conn.Close();
}
我收到错误:
Additional information: Procedure or function 'VendorsRowcount' expects parameter '@RowCount', which was not supplied.
我只是在学习VB之后学习C#并意识到Internet上的C#有更多的资源。
这可能是一个愚蠢的问题,但我已经搜查过,也许我使用的术语不是正确的,因为我找不到答案。
据我所知,我不需要发送参数,因为@RowCount
被输出。
为什么我得到这个错误?
但是你'@ RowCount'在你的SP? – 2014-08-29 20:50:23