public TeacherNormViewStudent(TeacherNorm a) { aTab = a; InitializeComponent(); DBConnect conn = new DBConnect(); String query = "Select `F_NAME`, `L_NAME`, `D_ID`, `GPA` from `students`"; conn.OpenConnection(); MySqlCommand cmd = new MySqlCommand(query, conn.getConnectionString()); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmd; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSource = new BindingSource(); bSource.DataSource = dbdataset; dataGridView1.DataSource = bSource; sda.Update(dbdataset); } catch (Exception ex) { MessageBox.Show(Convert.ToString(ex)); } }
public TeacherNormViewStudent(TeacherNorm a) { aTab = a; InitializeComponent(); string oradb = "Data Source=XE; User Id=RIAD;Password=1133;"; OracleConnection conn = new OracleConnection(oradb); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; //String query = "Select `F_NAME`, `L_NAME`, `D_ID`, `GPA` from `students`"; cmd.CommandText = "Select F_NAME, L_NAME, D_ID, GPA from STUDENTS"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); try { OracleDataAdapter sda = new OracleDataAdapter(); sda.SelectCommand = cmd; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSource = new BindingSource(); bSource.DataSource = dbdataset; dataGridView1.DataSource = bSource; sda.Update(dbdataset); } catch (Exception ex) { MessageBox.Show(Convert.ToString(ex)); } }
private void Login_Click(object sender, EventArgs e) { try { DBConnect conn = new DBConnect(); String query = "SELECT * FROM `prioritytable` WHERE `ID` = '" + metroTextBox1.Text + "' AND `Password` = '" + metroTextBox2.Text + "'"; MySqlDataReader dr = conn.Select(query); int priority = -1; while (dr.Read()) { UserName = Convert.ToString(dr["ID"]); Password = Convert.ToString(dr["Password"]); priority = Convert.ToInt32(dr["Priority"]); } if (UserName == metroTextBox1.Text && Password == metroTextBox2.Text) { switch (priority) { case 0: TeacherHigh aTeacher = new TeacherHigh(UserName); this.Hide(); aTeacher.Show(); break; case 1: TeacherNorm bTeacher = new TeacherNorm(UserName); this.Hide(); bTeacher.Show(); break; case 2: Student aStudent = new Student(UserName); this.Hide(); aStudent.Show(); break; case 3: Parent aParent = new Parent(UserName); this.Hide(); aParent.Show(); break; } //MessageBox.Show("Correct"); } else { MessageBox.Show("Incorrect"); } } catch (Exception ex) { MessageBox.Show(Convert.ToString(ex)); } }
public TeacherNormSearchStudentByID(TeacherNorm a) { aTab = a; InitializeComponent(); }
private void Login_Click(object sender, EventArgs e) { try { string oradb = "Data Source=XE; User Id=RIAD;Password=1133;"; OracleConnection conn = new OracleConnection(oradb); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT * FROM prioritytable WHERE ID = '" + metroTextBox1.Text + "' AND Password = '******'"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); int priority = -1; while (dr.Read()) { UserName = Convert.ToString(dr.GetString(0)); Password = Convert.ToString(dr.GetString(1)); priority = Convert.ToInt32(dr.GetValue(2)); } if (UserName == metroTextBox1.Text && Password == metroTextBox2.Text) { switch (priority) { case 0: TeacherHigh aTeacher = new TeacherHigh(UserName); this.Hide(); aTeacher.Show(); break; case 1: TeacherNorm bTeacher = new TeacherNorm(UserName); this.Hide(); bTeacher.Show(); break; case 2: Student aStudent = new Student(UserName); this.Hide(); aStudent.Show(); break; case 3: Parent aParent = new Parent(UserName); this.Hide(); aParent.Show(); break; } //MessageBox.Show("Correct"); } else { MessageBox.Show("Incorrect"); } } catch (Exception ex) { MessageBox.Show(Convert.ToString(ex)); } }