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