Try the following code..
public SqlDataReader PopulateUserDetails(string EmployeeNo)
{
SqlDataReader reader = null;
try
{
string strConnString = ConfigurationManager.ConnectionStrings["<connectionstringname>"].ConnectionString;
using(SqlConnection con = new SqlConnection())
{
SqlCommand cmd = new SqlCommand();
con.ConnectionString = strConnString;
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "dbo.sp_Getuserinfo";
SqlParameter param = new SqlParameter("@EmployeeNumber", EmployeeNo);
cmd.Parameters.Add(param);
reader = cmd.ExecuteReader();
}
}
catch (Exception ex)
{
if (handleErrors)
{
LogManager.Writer(ex.Message,LogType.Error);
}
else
throw;
}
return reader;
}
you are unnecessarily adding the SqlParameter more than once
following is your part of code
SqlParameter param = new SqlParameter("@EmployeeNumber", SqlDbType.Int);
param.Direction = ParameterDirection.InputOutput;
param.Value = lblEmployeeNumber.Text;
cmd.Parameters.Add(param);
cmd.Parameters.AddWithValue("@EmployeeNumber", EmployeeNo);
cmd.Parameters.Add("@EmployeeNumber", System.Data.SqlDbType.VarChar, 30);
with in your stored procedure, you are not declared any output parameter.. and you declared one output parameter in C# code.
that is the reason, it is throwing "
expects parameter '@EmployeeNumber', which was not supplied."
If you want more help see the above code for ref.
Let us know, still if you are not able to resolve the prob..
Happy coding.. :)