我有以下代码:
public static void executeStoredProcedure(SqlCommand sp)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString=Connection.getConnection();
conn.Open();
sp.CommandType = CommandType.StoredProcedure;
sp.Connection = conn;
sp.ExecuteNonQuery();
conn.Close();
}
此代码执行存储过程。
但我的存储过程是
Create procedure [dbo].[selectAllItems]
(@ItemCode varchar(50) )
as
begin
select * from Item where ItemCode = @ItemCode
end
它将返回行,但如何在上面的 c# 代码中获得此结果