I am facing the below error
'int' does not contain a definition for 'LeaveType' and no extension method 'LeaveType' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)
here is my code :
public DataSet GetLeaveRecord(int empID)
{
DataSet ds = new DataSet();
try
{
SqlCommand cmd = new SqlCommand("[p_GetLeaveRecord_LMS]", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
cmd.Parameters.AddWithValue("@LeaveType", empID.LeaveType);
cmd.Parameters.AddWithValue("@IdEmployee", empID.EmployeeId);
cmd.Parameters.AddWithValue("@DateFrom", empIDd.DateFrom);
cmd.Parameters.AddWithValue("@DateTo ", empID.DateTo);
cmd.Parameters.AddWithValue("@Reason", empID.Reason);
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
adapter.Fill(ds);
}
catch (Exception e)
{
throw e;
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
return ds;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…