Ankit Kumar

Ankit Kumar

  • NA
  • 159
  • 48.3k

Output Parameter is not returning value

Sep 5 2017 8:25 AM
Hello friends,
 
My stored is not returning any value in output parameter, Code is given below.
 
try
{
//Declaring parameter
SqlParameter[] parameter = new SqlParameter[2];
//name and type declaration of the table variable to be passed as parameter
parameter[0] = new SqlParameter("@EmpDetails",dt);
parameter[0].Direction = ParameterDirection.Input;
parameter[0].SqlDbType = SqlDbType.Structured;
parameter[1] = new SqlParameter();
parameter[1].ParameterName = "@errormessage";
parameter[1].Direction = ParameterDirection.Output;
parameter[1].SqlDbType = SqlDbType.VarChar;
parameter[1].Size = 1000;
//invoking stored procedure ImportEmployee
SqlHelper.ExecuteNonQuery(connectsql, CommandType.StoredProcedure, "sp_importemployee", parameter);
if (parameter[1].Value.ToString() != "")
{
Errors=(parameter[1].Value.ToString());
}
}
catch (Exception ex)
{
Errors=ex.Message.ToString();
}
 
 
 Any quick help will be very much appreciable
 
 
 

Answers (8)