Exemple #1
0
        private void btnUpdate_record_Click(object sender, EventArgs e)
        {
            try
            {
                con = new SqlConnection(cs.DBcon);
                con.Open();
                string cb = "update Hosteler set HostelName=@d3,joiningDate=@d4 where AdmissionNo='" + AdmissionNo.Text + "'";
                cmd            = new SqlCommand(cb);
                cmd.Connection = con;

                cmd.Parameters.AddWithValue("@d3", cmbHostelName.Text);
                cmd.Parameters.AddWithValue("@d4", dtpJoiningDate.Text);

                cmd.ExecuteReader();
                MessageBox.Show("Successfully updated", "Hostel Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
                st1 = lblUser.Text;
                st2 = "Update the Hosteler '" + StudentName.Text + "'";
                cf.LogFunc(st1, System.DateTime.Now, st2);
                btnUpdate_record.Enabled = false;
                FrmHostelinfoRecord frm = new FrmHostelinfoRecord();
                frm.GetData();
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }

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

            frm.lblUser.Text     = lblUser.Text;
            frm.lblUserType.Text = lblUserType.Text;
            frm.Show();
            frm.GetData();
        }
Exemple #3
0
        private void btnUpdate_record_Click(object sender, EventArgs e)
        {
            try
            {
                con = new SqlConnection(cs.DBcon);
                con.Open();
                string cb = "update Hostelinfo set Hostelname=@d2,Hostel_address=@d3,Hostel_Phone=@d4,ManagedBy=@d5,Hostel_ContactNo=@d6,HostelFees=@d7 where ID=@d1";
                cmd            = new SqlCommand(cb);
                cmd.Connection = con;
                cmd.Parameters.AddWithValue("@d2", txtHostelName.Text);
                cmd.Parameters.AddWithValue("@d1", txtID.Text);
                cmd.Parameters.AddWithValue("@d3", txtAddress.Text);
                cmd.Parameters.AddWithValue("@d4", txtPhoneNo.Text);
                cmd.Parameters.AddWithValue("@d5", txtManagedBy.Text);
                cmd.Parameters.AddWithValue("@d6", txtContactNo.Text);
                cmd.Parameters.AddWithValue("@d7", txtHostelFees.Text);
                cmd.ExecuteReader();
                MessageBox.Show("Successfully updated", "Hostel Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
                st1 = lblUser.Text;
                st2 = "Deleted the Hostel '" + txtHostelName.Text + "'";
                cf.LogFunc(st1, System.DateTime.Now, st2);
                btnUpdate_record.Enabled = false;
                FrmHostelinfoRecord frm = new FrmHostelinfoRecord();
                frm.GetData();
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }

                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }