hi guys. i hve a database name event. i hve a studentaccount table and faculty account table. studentaccount table has id,vstudentname columns and faculty account has id,vfacultyname columns. i want to add both table ids to combobox. how can i acheive that. i hve successfully managed to do it for single table.
private void AdminChat_Load(object sender, EventArgs e)
{
comboBox1.Visible = false;
string ConnectionString = "Data Source=GHOST-PC\\SQLEXPRESS;Initial Catalog=Event;Integrated Security=True";
SqlConnection con = new SqlConnection(ConnectionString);
con.Open();
SqlCommand sc = new SqlCommand("select vuser,vStudentName from StudentAccount", con);
SqlDataReader reader;
reader = sc.ExecuteReader();
DataTable dt = new DataTable();
dt.Columns.Add("vuser", typeof(string));
dt.Columns.Add("vStudentName", typeof(string));
dt.Load(reader);
comboBox2.ValueMember = "vuser";
comboBox2.DisplayMember = "vStudentName";
comboBox2.DataSource = dt;
}