Example #1
0
        private void btnUpdate_record_Click(object sender, EventArgs e)
        {
            try
            {
                con = new SqlConnection(cs.DBcon);
                con.Open();

                string cb = "update Event set Eventname='" + txtEventName.Text + "', StartingDate='" + dtpStartingDate.Text + "' , StartingTime='" + dtpStartingTime.Text + "' , EndingDate='" + dtpEndingDate.Text + "' , EndingTime ='" + dtpEndingTime.Text + "' , ManagedBy='" + textBox1.Text + "' , Activities='" + txtActivities.Text + "' where EventID='" + txtEventID.Text + "' ";
                cmd            = new SqlCommand(cb);
                cmd.Connection = con;
                cmd.ExecuteReader();
                frmEventRecords frm = new frmEventRecords();
                frm.GetData();
                MessageBox.Show("Successfully updated", "Event Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
                st1 = lblUser.Text;
                st2 = "Updated the Event'" + txtEventName.Text + "'";
                cf.LogFunc(st1, System.DateTime.Now, st2);
                btnUpdate_record.Enabled = false;


                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }

                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmEventRecords form2 = new frmEventRecords();

            form2.lblUser.Text     = lblUser.Text;
            form2.lblUserType.Text = lblUserType.Text;

            form2.Show();
        }