private void back_Click(object sender, EventArgs e) { fir_form logout = new fir_form(); this.Hide(); logout.Show(); }
private void dataGridView_fir_CellClick(object sender, DataGridViewCellEventArgs e) { int id = Convert.ToInt32(dataGridView_fir.Rows[e.RowIndex].Cells["fir_no"].Value.ToString()); //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=" + id + " "; SqlDataAdapter sda = new SqlDataAdapter(query, sqlConnection); DataTable d = new DataTable(); sda.Fill(d); fir_form display = new fir_form(d); this.Hide(); display.Show(); }
private void button1_Click(object sender, EventArgs e) { // SqlConnection con = new SqlConnection(@"Data Source=desktop-olv0avb\sqlexpress;Initial Catalog=police_management_system;Integrated Security=True;Pooling=False"); string query = "select * from login_table where user_name='" + textBox1.Text.Trim() + "'and password='******' "; SqlDataAdapter sda = new SqlDataAdapter(query, sqlConnection); DataTable d = new DataTable(); sda.Fill(d); if (d.Rows.Count == 1) { string account_type = d.Rows[0]["account_type"].ToString(); switch (account_type) { case "admin": adminform admin = new adminform(); this.Hide(); admin.Show(); break; case "employee": emp_form emp = new emp_form(); this.Hide(); emp.Show(); break; case "fir": fir_form fir = new fir_form(); this.Hide(); fir.Show(); break; } } else { MessageBox.Show("Incorrect user name or password"); } }