Exemple #1
0
        private void comboBoxLoad()
        {
            MySqlConnection conn = new MySqlConnection(Login.connectionString);
            DataSet         ds   = new DataSet();

            try
            {
                conn.Open();

                MySqlCommand     cmd = new MySqlCommand("select * from login_details inner join employee on login_details.employeeId=employee.employeeId where login_details.authLevel='Doctor'", conn);
                MySqlDataAdapter da  = new MySqlDataAdapter();
                da.SelectCommand = cmd;
                da.Fill(ds);
                doctorEntry.DisplayMember = "employeeId";
                doctorEntry.ValueMember   = "employeeId";
                doctorEntry.DataSource    = ds.Tables[0];

                doctorEntry2.DisplayMember = "employeeId";
                doctorEntry2.ValueMember   = "employeeId";
                doctorEntry2.DataSource    = ds.Tables[0];
            }
            catch (Exception ex)
            {
                //Exception Message
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }

            string query        = "select employee.employeeId,fname,lname from employee inner join login_details on employee.employeeId=login_details.employeeId where login_details.authLevel='Doctor'";
            Crud   employeeList = new Crud();

            employeeList.createTable2(query, doctorList);

            Crud employeeList2 = new Crud();

            employeeList2.createTable2(query, doctorList2);
        }