private void delbtn_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 fir_table where fir_no=" + textBox1.Text + ""; SqlDataAdapter sda = new SqlDataAdapter(query, c); DataTable d = new DataTable(); sda.Fill(d); firrecord display = new firrecord(d); this.Hide(); display.Show(); }
private void submit_detail_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 fir_table values(" + textBox1.Text + " , " + textBox2.Text + " , '" + textBox3.Text + "' , '" + textBox4.Text + "' , '" + textBox5.Text + "' , '" + textBox6.Text + "' , '" + textBox7.Text + "' , '" + details.Text + "' )"; SqlDataAdapter sda = new SqlDataAdapter(query, c); DataTable d = new DataTable(); sda.Fill(d); firrecord display = new firrecord(d); this.Hide(); display.Show(); }
private void updatebtn_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 fir_table set fir_no=" + textBox1.Text + ", wriiten_by=" + textBox2.Text + ", police_station_no='" + textBox3.Text + "', crime_no='" + textBox4.Text + "' , victum='" + textBox5.Text + "', suspect='" + textBox6.Text + "', time_stamp='" + textBox7.Text + "', details='" + details.Text + "' where fir_no=" + textBox1.Text + " "; SqlDataAdapter sda = new SqlDataAdapter(query, c); DataTable d = new DataTable(); sda.Fill(d); firrecord display = new firrecord(d); this.Hide(); display.Show(); }
private void searchbtn_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 fir_table where fir_no=" + textBox1.Text + " "; SqlDataAdapter sda = new SqlDataAdapter(query, c); DataTable d = new DataTable(); sda.Fill(d); if (d.Rows.Count == 0) { MessageBox.Show("WARNING! THE DATA YOU MAY SEARCH IS NOT IN THE DATABASE PLEASE TRY AGAIN THANKS 😁"); } else { firrecord display = new firrecord(d); this.Hide(); display.Show(); } }