title: How to Display data in datagridview from access database
body: <p>I have the codes below here in displaying data in datagridview from access database. I have different rows but in only display the last row of data in database. I dont know what's wrong in my code.</p>
  
  <pre><code>    dataGridView1.Columns.Add("UserID", "UserID");
      dataGridView1.Columns.Add("FirstName", "FirstName");
      dataGridView1.Columns.Add("MI", "MI");
      dataGridView1.Columns.Add("LastName", "LastName");
      dataGridView1.Columns.Add("Birthdate", "Birthdate");
      dataGridView1.Columns.Add("Address", "Address");
      dataGridView1.Columns.Add("UserName", "UserName");
      dataGridView1.Columns.Add("UserPassword", "UserPassword");
      dataGridView1.Columns.Add("Rights", "Rights");
  
  
      OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\SISC-STRONGHOLD\MIS!\wilbert.beltran\SEEDBucksDbase.accdb");
      conn.Open();
      OleDbCommand cmd = new OleDbCommand();
      cmd.Connection = conn;
      cmd.CommandText = "SELECT * From TableAcct";
      OleDbDataReader reader = cmd.ExecuteReader();
      while (reader.Read())
      {
          dataGridView1.Rows.Add();
  
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["UserID"].Value = reader[0].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["FirstName"].Value = reader[1].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["MI"].Value = reader[2].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["LastName"].Value = reader[3].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["Birthdate"].Value = reader[4].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["Address"].Value = reader[5].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["UserName"].Value = reader[7].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["UserPassword"].Value = reader[8].ToString();
          dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["Rights"].Value = reader[9].ToString();
      }
      conn.Close();
  }
  </code></pre>