For each record returned from the database, you're creating a new
DataGridViewComboBoxCell
, adding one item to it, and replacing the third cell of the first row with the new single-record combobox.
You need to move the cell creation and assignment outside of the
while
loop.
const string query = "select distinct RTRIM(faheads) from FA_Details";
var c = new DataGridViewComboBoxCell();
dataGridView1.Rows[0].Cells[2] = c;
using (var con = new SqlConnection(cs))
using (var cmd = new SqlCommand(query, con))
{
con.Open();
using (var rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (rdr.Read())
{
c.Items.Add(rdr[0]);
}
}
}