How do we display data from database into DataGridViewComboBoxColumn in Windows form C#?
My database table ticket looks like this:
I want to display it into my dataGridView which has two DataGridViewComboBoxColumn named cbxSeverity and cbxStatus:
I tried the code below from the tutorial but it does not work on ComboBoxColumn:
con.Open();
cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT * FROM Ticket";
cmd.ExecuteNonQuery();
dt = new DataTable();
da = new SqlDataAdapter(cmd);
da.Fill(dt);
dataGridView.DataSource = dt;
con.Close();
I'm new at this and the tutorial that I watched only used TextBoxColumn, please advise thank you.