I am trying to get the output of a stored procedure into a function but with my code i am always getting a error telling that the output parameter is not specified.Can u help?
the code is here.....
public int UserAuthentication(String username, String password)
{
SqlConnection conn = new SqlConnection("Data Source=CLEMATIS-11\\CLEMATISTECH; Initial Catalog=CUSTOMER360;User ID=sa;password=clematis1$");
SqlCommand command = new SqlCommand("sp_Campaign_UserAuthentication", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@login_id", SqlDbType.VarChar, 50, "loginid"));
command.Parameters.Add(new SqlParameter("@password",
SqlDbType.VarChar,50,
"password"));
SqlParameter ret = command.Parameters.Add(" @result", SqlDbType.Int);
ret.Direction = ParameterDirection.ReturnValue;
command.Parameters["@login_id"].Value = username;
command.Parameters["@password"].Value = password;
conn.Open();
command.ExecuteNonQuery();
conn.Close();
return (int)ret.Value;
}