title: Compare between 2 tables in 2 different databases
body: <p>I have 2 access databases one called <code>revision</code> and the other called <code>revision2</code>. Each database has a table called <code>batch</code>.</p>
  
  <p>I have <code>DataGridView</code> that shows the data in the first database.</p>
  
  <p>I need to compare between the 2 tables from the different databases and what matches get a green color in the <code>DataGridView</code>. </p>
  
  <p>I used that code but it only colors the first match not all,</p>
  
  <pre><code>private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
  {
      OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\revision.accdb");
      OleDbConnection con2 = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\revision2.accdb");
      OleDbCommand cmd = new OleDbCommand("select * From batch", con);
      OleDbCommand cmd2 = new OleDbCommand("select * From batches", con2);
      con.Open();
      con2.Open();
      OleDbDataReader dr = cmd.ExecuteReader();
      OleDbDataReader dr2 = cmd2.ExecuteReader();
      dr.Read();
      dr2.Read();
      DataTable dt = new DataTable();
      dt.Columns.Add("batch_no");
      if (dr["batch_no"].ToString() == dr2["batch_no"].ToString())
      {
          string num = dr["batch_no"].ToString();
          foreach (DataGridViewRow myrow in dataGridView1.Rows)
          {
              if (Convert.ToString(myrow.Cells[0].Value) == num)
              {
                  myrow.DefaultCellStyle.BackColor = Color.Green;
              }
              else
              {
  
              }
          }
          con.Close();
          con2.Close();
      }
  }
  </code></pre>
  
  <p>Any solution to get what all what matches and color it? Or any better ideas?</p>