public void display() { SQLiteConnection sqlite_conn; SQLiteCommand sqlite_cmd; //SQLiteDataReader sqlite_datareader; Receptionists A2 = new Receptionists(); sqlite_conn = new SQLiteConnection("Data Source=ReceptionistLogin.db;Version=3;Compress=True;"); sqlite_conn.Open(); sqlite_cmd = sqlite_conn.CreateCommand(); sqlite_cmd.CommandText = "SELECT Username FROM Login where Username='******' and Password='******'"; sqlite_cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SQLiteDataAdapter da = new SQLiteDataAdapter(sqlite_cmd); da.Fill(dt); dataGridView1.DataSource = dt; sqlite_conn.Close(); }
private void button4_Click(object sender, EventArgs e) { var result = MessageBox.Show("Do you want to delete your account ? After pressing yes you will be logout from account and your account will be remove!", "Delete Account", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Receptionists A1 = new Receptionists(); SQLiteConnection sqlite_conn; SQLiteCommand sqlite_cmd; SQLiteDataReader sqlite_dataread; SQLiteConnection sqlite_conn1; SQLiteCommand sqlite_cmd1; sqlite_conn = new SQLiteConnection("Data Source=ReceptionistLogin.db;Version=3;Compress=True;"); sqlite_conn.Open(); sqlite_cmd = sqlite_conn.CreateCommand(); sqlite_cmd.CommandText = "Select * from Login where Username='******' and Password='******'"; sqlite_dataread = sqlite_cmd.ExecuteReader(); if (sqlite_dataread.Read()) { sqlite_conn.Close(); sqlite_conn1 = new SQLiteConnection("Data Source=ReceptionistLogin.db;Version=3;Compress=True;"); sqlite_conn1.Open(); sqlite_cmd1 = sqlite_conn1.CreateCommand(); sqlite_cmd1.CommandText = "Delete from Login where Username='******' and Password='******'"; sqlite_cmd1.ExecuteNonQuery(); sqlite_conn1.Close(); i = 1; this.Hide(); this.Close(); } else { i = 0; sqlite_conn.Close(); MessageBox.Show("Username and Password is incorrect!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }