我面临以下错误
“int”不包含“LeaveType”的定义,并且找不到接受“int”类型的第一个参数的扩展方法“LeaveType”(您是否缺少 using 指令或程序集引用?)
这是我的代码:
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;
}