sqlhelper+.net接收存储过程的输出值

来源:百度知道 编辑:UC知道 时间:2024/07/07 16:18:07
如题,我使用了SqlHelper类,一个带输出值的存储过程

现在想在类文件中用a来获取这个存储过程的输出值

不知道怎么做

ps:相关代码
类文件
public int UserLogin(string email, string password, out int error)
{
error = 0;
SqlParameter[] parameters =
{
new SqlParameter("@p_email",email),
new SqlParameter("@p_password",password),
new SqlParameter("@p_error", error)
};
SqlHelper.ExecuteNonQuery(Conn.ConnectionString2000, CommandType.StoredProcedure, "P_User_Login", parameters);

return int.Parse(parameters[2].ToString());//这里有错误

}

存储过程
CREATE PROC P_User_Login
(
@p_email nvarchar(50),
@p_password nvarchar(100),
@p_error int out
)
AS
IF NOT EXISTS(SELECT Email
FROM T_User_Secu

SqlParameter output = new SqlParameter("@p_error", error) ;
output.Direction = ParameterDirection.Output;
同时返回结果集要用ExecuteQuery

如果你的sqlhelper没有那种功能,那就没有办法。这个sqlhelper本来就是自己随便写的。