private void buttonManageUpdate_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Server = localhost\\SQLEXPRESS01; Database = IT19119618; Integrated Security = True;"); SqlCommand cmd; cmd = new SqlCommand("update lecture set Employeeid=@Employeeid,LectureName=@LectureName,faculty=@faculty,Department=@Department,Center=@Center,Building=@Building,Level=@Level,Rank=@Rank where id=@id", con); con.Open(); cmd.Parameters.AddWithValue("@Employeeid", textBoxRoom.Text.ToString()); cmd.Parameters.AddWithValue("@LectureName", textBoxBuilding.Text.ToString()); cmd.Parameters.AddWithValue("@faculty", comboBox1.Text.ToString()); cmd.Parameters.AddWithValue("@Department", comboBox2.Text.ToString()); cmd.Parameters.AddWithValue("@Center", comboBox3.Text.ToString()); cmd.Parameters.AddWithValue("@Building", comboBox4.Text.ToString()); cmd.Parameters.AddWithValue("@Level", comboBox5.Text.ToString()); cmd.Parameters.AddWithValue("@Rank", textBoxCapacity.Text.ToString()); cmd.Parameters.AddWithValue("@id", dataId); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Update Successfully!!!"); ManageLectures m1 = new ManageLectures(); this.Hide(); m1.Show(); }
private void buttonView_Click_1(object sender, EventArgs e) { if (m1 == null || m1.IsDisposed) { m1 = new ManageLectures(); } m1.Show(); this.Hide(); }
private void buttonManageDelete_Click_1(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Server = localhost\\SQLEXPRESS01; Database = IT19119618; Integrated Security = True;"); SqlCommand cmd; cmd = new SqlCommand("delete from lecture where id=@id", con); con.Open(); cmd.Parameters.AddWithValue("@id", dataId); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Deleted Successfully!!!"); ManageLectures m1 = new ManageLectures(); this.Hide(); m1.Show(); }
public AddLectures(ManageLectures m) { InitializeComponent(); this.m1 = m; }