Example #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            //for deleting data

            InputModal modal = new InputModal("Delete Record", "Delete");

            modal.ShowDialog();
            int      id         = modal.GetUserInput();
            string   temp_query = String.Format("delete from students where id = {0}", id);
            Database db         = new Database();

            db.AddQuery(temp_query);
            int status = db.ExecuteQuery();

            db.CloseConnection();
            if (status == 1)
            {
                MessageBox.Show("Record Deleted Successfully!");
            }
            else
            {
                MessageBox.Show("Unable to delete record");
            }
            GetData();
        }
Example #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            InputModal modal = new InputModal("Find Records", "find");

            modal.ShowDialog();
            int returned_id = modal.GetUserInput();

            if (returned_id != 0)
            {
                string temp_query = String.Format("select * from students where id = {0}", returned_id);

                List <TextBox> TextBoxes = new List <TextBox>();

                TextBoxes.Add(textBox1);
                TextBoxes.Add(textBox2);
                TextBoxes.Add(textBox3);
                TextBoxes.Add(textBox4);
                TextBoxes.Add(textBox5);

                Database db = new Database();
                db.AddQuery(temp_query);
                db.GetResultSet(TextBoxes);
                db.CloseConnection();
            }
        }