private void update_btn_Click(object sender, EventArgs e) { // SqlConnection c = new SqlConnection(@"Data Source=desktop-olv0avb\sqlexpress;Initial Catalog=police_management_system;Integrated Security=True;Pooling=False"); string query = " update employee_table set police_id=" + text_id.Text + " , Name = '" + text_Name.Text + "' , Rank='" + text_rank.Text + "' , Address='" + text_address.Text + "' , [D.O.B]='" + text_dob.Text + "' , Grade=" + textBox1.Text + " , CNIC='" + text_cnic.Text + "' , date_of_employment='" + text_doe.Text + "' , date_of_retirement='" + textBox2.Text + "' , Gender='" + comboBox1.Text + "' where police_id=" + text_id.Text + " "; SqlDataAdapter sda = new SqlDataAdapter(query, sqlConnection); DataTable d = new DataTable(); sda.Fill(d); datashow display = new datashow(d); this.Hide(); display.Show(); }
private void insert_btn_Click(object sender, EventArgs e) { // SqlConnection c = new SqlConnection(@"Data Source=desktop-olv0avb\sqlexpress;Initial Catalog=police_management_system;Integrated Security=True;Pooling=False"); string query = "insert into employee_table values(" + text_id.Text + ",'" + text_Name.Text + "','" + text_rank.Text + "','" + text_address.Text + "','" + text_dob.Text + "'," + textBox1.Text + ",'" + text_cnic.Text + "','" + text_doe.Text + "','" + textBox2.Text + "','" + comboBox1.Text + "') "; SqlDataAdapter sda = new SqlDataAdapter(query, sqlConnection); DataTable d = new DataTable(); sda.Fill(d); datashow display = new datashow(d); this.Hide(); display.Show(); }
private void del_btn_Click(object sender, EventArgs e) { // SqlConnection c = new SqlConnection(@"Data Source=desktop-olv0avb\sqlexpress;Initial Catalog=police_management_system;Integrated Security=True;Pooling=False"); string query = " delete from employee_table where police_id=" + text_id.Text + " "; SqlDataAdapter sda = new SqlDataAdapter(query, sqlConnection); DataTable d = new DataTable(); sda.Fill(d); datashow display = new datashow(d); this.Hide(); display.Show(); }
private void search_btn_Click(object sender, EventArgs e) { // SqlConnection c = new SqlConnection(@"Data Source=desktop-olv0avb\sqlexpress;Initial Catalog=police_management_system;Integrated Security=True;Pooling=False"); string query = "select * from employee_table where police_id=" + text_id.Text + " "; SqlDataAdapter sda = new SqlDataAdapter(query, sqlConnection); DataTable d = new DataTable(); sda.Fill(d); if (d.Rows.Count == 0) { MessageBox.Show("WARNING! YOU MIGHT INPUTTED WRONG ID PLEASE TRY AGAIN THANKS 😁"); } else { datashow display = new datashow(d); this.Hide(); display.Show(); } }