Beispiel #1
0
        ////////////////////        Add Button          ///////////////////
        private void button1_Click(object sender, EventArgs e)
        {
            string connString = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=E:\\ITS245\\STEFPROJ\\Database11.accdb";

            OleDbConnection connection = new OleDbConnection(connString);
            OleDbCommand    cmd        = connection.CreateCommand();

            connection.Open();

            cmd.CommandText = "Insert into Patienttable (PtLastName, PtFirstName,DOB) VALUES" + "(" + "'" + Lname.Text + "'" + "," + "'" + Fname.Text + "'" + "," + "'" + AGE.Text + "'" + ")";
            cmd.Connection  = connection;


            OleDbDataReader reader = cmd.ExecuteReader();

            connection.Close();
            this.BackColor = Color.LightBlue;
            Lname.ReadOnly = true;
            Fname.ReadOnly = true;
            AGE.ReadOnly   = true;
            listBox1.Update();

            ADDButton.Hide();
            Save.Hide();
        }
Beispiel #2
0
        ////////////            Save Button         ////////////
        private void Save_Click(object sender, EventArgs e)
        {
            string connString = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=E:\\ITS245\\STEFPROJ\\Database11.accdb";

            OleDbConnection connection = new OleDbConnection(connString);
            OleDbCommand    cmd        = connection.CreateCommand();

            connection.Open();

            cmd.Connection = connection;


            cmd.CommandText = "Update patienttable set PtLastName =" + "'" + Lname.Text + "'" + ",PtFirstname =" + "'" + Fname.Text + "'" + " where PatientID=" + PatientID.Text;
            OleDbDataReader reader2 = cmd.ExecuteReader();

            reader2.Read();
            reader2.Close();

            connection.Close();

            this.BackColor = Color.LightBlue;
            Lname.ReadOnly = true;
            Fname.ReadOnly = true;
            AGE.ReadOnly   = true;

            listBox1.Update();

            Save.Hide();
            ADDButton.Hide();
        }
Beispiel #3
0
        //////////////     Modify Button        //////////
        private void Modify_Click(object sender, EventArgs e)
        {
            //// send it the object made from class and leave the e////
            Modname mod = new Modname(Fname.Text, Lname.Text, AGE.Text);

            Undo_Click(mod, e);

            this.BackColor = Color.Blue;
            Lname.ReadOnly = false;
            Fname.ReadOnly = false;
            AGE.ReadOnly   = false;

            Save.Show();
            ADDButton.Show();
        }