title: I have a problem with link datagridview and custome database column
body: <pre><code>private void Purchases_Load(object sender, EventArgs e)
  {
  com.Connection = con;
  con.Open();
  com.CommandText = &quot;select * from Items&quot;;
  com.ExecuteNonQuery();
  DataTable dt7 = new DataTable();
  SqlDataAdapter da7 = new SqlDataAdapter(com);
  da7.Fill(dt7);
  ComboColumn.DataSource = dt7;
  ComboColumn.DisplayMember = &quot;Name&quot;;
  }
  
  private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  {
  com.Connection = con;
  com.CommandText = &quot;select ID from Items where Name = '&quot; + ComboColumn + &quot;' &quot;;
  con.Open();
  com.ExecuteNonQuery();
  SqlDataReader dr;
  dr = com.ExecuteReader();
  while (dr.Read())
  {
      string id = (string)dr[&quot;ID&quot;].ToString();
  }
  con.Close();
  }
  </code></pre>
  <p>I have sql db table contains ID and Items.
  also, I have winform and I'm using DataGrid type &quot;DataGridViewComboBoxColumn&quot; to select the items from db table and it's working perfectly
  now, The problem is I need to show the following &quot;ID column&quot; to the second column in DGV while I selec<a href="https://i.stack.imgur.com/QFpMO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QFpMO.jpg" alt="enter image description here" /></a>ting the items from &quot;DataGridViewComboBoxColumn&quot;.
  So, I need help to link a specific column in database which is (ID) with a specific column on datagrid column type &quot;DataGridViewTextBoxColumn&quot; when user select items from the gdv ComboBoxColumn.</p>
  <p>note: 1st scop of code working and giving me items from db.
  2nd scop of code not working and I can't handle it for retrieve ID from db table!!</p>