I want to store once Column data of Table in combobox1? Here is the code that isn't working:
SqlCommand cmdRe = new SqlCommand("select FK_RoleID from SO_User_Table", cn);
SqlDataAdapter da = new SqlDataAdapter();
DataTable dt = new DataTable();
try
{
cn.Open();
da.SelectCommand = cmdRe;
da.Fill(dt);
// textBox1.Text = dt.Rows[0].ItemArray[0].ToString();
this.comboBox1.DisplayMember= "FK_RoleID";
this.comboBox1.ValueMember = "FK_RoleID";
this.comboBox1.DataSource = da;
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
cn.Close();
}