private void Form2_Load(object sender, EventArgs e) { string sql = "select * from Student"; SQLConn db = new SQLConn(); dt = db.selectData(sql); dataGridView1.DataSource = dt; }
private void Delete_Load(object sender, EventArgs e) { string sql = "select * from Student"; SQLConn db = new SQLConn(); DataTable dt = new DataTable(); dt = db.selectData(sql); comboBox1.DataSource = dt; comboBox1.DisplayMember = "ID"; }
private void Form3_Load(object sender, EventArgs e) { string sql = "select * from Student"; SQLConn db = new SQLConn(); DataTable dt = new DataTable(); dt = db.selectData(sql); comboBox1.DataSource = dt; comboBox1.DisplayMember = "ID"; textBox1.DataBindings.Add("Text", dt, "firstName"); }
private void button1_Click_1(object sender, EventArgs e) { string sql = "delete from Student where ID = " + Convert.ToInt16(comboBox1.Text.ToString()) + ""; SQLConn db = new SQLConn(); bool verify = db.manipulateData(sql); if (verify == false) { MessageBox.Show("Some ERROR occured!"); } else { MessageBox.Show("Record has sucessfully updated!"); } this.Close(); }
private void button1_Click_1(object sender, EventArgs e) { string sql = "insert into Student values('" + textBox1.Text + "','" + textBox2.Text + "')"; SQLConn db = new SQLConn(); bool verify = db.manipulateData(sql); if (verify == false) { MessageBox.Show("Some ERROR occured!"); } else { MessageBox.Show("Record has sucessfully added!"); } this.Close(); }