title: Return data in Datagrid and proceudre from datareader value
body: <p>I am doing a report for attendance that gets all employees, </p>
  
  <p>basically what I am trying to do, is based on each employee userID returns the attendance based on the dates from the datereader that loops for all userID's  and then place it in the datagridview.</p>
  
  <p>However there is something wrong, it returns only the last UserID, I have tried to place out of the loop but same returns only last userID. </p>
  
  <p>code as below</p>
  
  <pre><code>MainClass.Connect();
  SqlCommand Com_UserID = new SqlCommand("Select UserID From Tuser",MainClass.MyCon);
  MainClass.MyCon.Open();
  
  SqlCommand Com_Attendance = new SqlCommand("SP_EmployeeAttendance",MainClass.MyCon);
  Com_Attendance.CommandType = CommandType.StoredProcedure;
  SqlDataAdapter Da = new SqlDataAdapter(Com_Attendance);
  DataSet Ds = new DataSet();
  
  SqlParameter P1 = new SqlParameter("@UserID",SqlDbType.NVarChar,50);
  P1.Direction = ParameterDirection.Input ;
  Com_Attendance.Parameters.Add(P1);
  
  Com_Attendance.Parameters.Add("@StartDate", SqlDbType.Date).Value = DTDeptStartDate.Value;
  Com_Attendance.Parameters.Add("@EndDate", SqlDbType.Date).Value = DTDeptEndDate.Value; ;
  
  SqlDataReader reader = Com_UserID.ExecuteReader();
  
  if (reader.HasRows)
  {
      while (reader.Read())
          P1.Value = reader.GetString(0);
      Com_Attendance.ExecuteNonQuery();
      Da.Fill(Ds);
      dataGridView1.DataSource = Ds.Tables[0];
      reader.NextResult(); 
  }
  </code></pre>