public TeacherHighStudentView(TeacherHightViewSelection 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 * from `students`"; cmd.CommandText = "Select * from Students"; cmd.CommandType = CommandType.Text; 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)); } }
public TeacherHighStudentView(TeacherHightViewSelection a) { aTab = a; InitializeComponent(); DBConnect conn = new DBConnect(); String query = "Select * 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)); } }
private void metroButton5_Click(object sender, EventArgs e) { this.Hide(); TeacherHightViewSelection dSelection = new TeacherHightViewSelection(this); dSelection.Show(); }