//ADD NEW CHILD
        public void NewChildRegister
        (
            int _chilNo,
            string _childName,
            int _age,
            string _gender,
            string _address,
            string _gnDivision,
            string _motherName,
            string _motherEdu,
            string _fatherName,
            string _fatherEdu,
            decimal _income,
            string _childInEdu,
            int _contactNo,
            string _disabilities,
            DateTime _birthday,
            string _rehabilitationAct,
            string _house,
            string _sanitationFacilities,
            string _donationGOV,
            string _donation_NGO
        )
        {
            SqlCommand cmd = new SqlCommand(@"INSERT INTO tbl_cbrdata VALUES('" + _chilNo + "','" + _childName + "','" + _age + "','" + _gender + "','" + _address + "','" + _gnDivision + "','" + _motherName + "','" + _motherEdu + "','" + _fatherName + "','" + _fatherEdu + "','" + _income + "','" + _childInEdu + "','" + _contactNo + "','" + _disabilities + "','" + _birthday + "','" + _rehabilitationAct + "','" + _house + "','" + _sanitationFacilities + "','" + _donationGOV + "','" + _donation_NGO + "')", ConnectionDB.connection());

            cmd.ExecuteNonQuery();
        }
        public void UpdateChild
        (
            int _childNo,
            string _childName,
            int _age,
            string _gender,
            string _address,
            string _gnDivision,
            string _motherName,
            string _motherEdu,
            string _fatherName,
            string _fatherEdu,
            decimal _income,
            string _childInEdu,
            int _contactNo,
            string _disabilities,
            DateTime _birthday,
            string _rehabilitationAct,
            string _house,
            string _sanitationFacilities,
            string _donationGOV,
            string _donation_NGO
        )
        {
            SqlCommand cmd = new SqlCommand("UPDATE tbl_cbrdata SET child_name='" + _childName + "', age='" + _age + "', gender='" + _gender + "', address='" + _address + "', gn_division='" + _gnDivision + "', mother_name='" + _motherName + "', mother_edu='" + _motherEdu + "', father_name='" + _fatherName + "', father_edu='" + _fatherEdu + "', income='" + _income + "', child_in_edu='" + _childInEdu + "', contact_no='" + _contactNo + "', disabilities='" + _disabilities + "' , birthday='" + _birthday + "' , rehabilitation_act='" + _rehabilitationAct + "' , house='" + _house + "' , sanitation_facilities='" + _sanitationFacilities + "' , donation_gov='" + _donationGOV + "' , donation_ngo='" + _donation_NGO + "' WHERE child_no='" + _childNo + "'", ConnectionDB.connection());

            cmd.ExecuteNonQuery();
        }
        //CHANGE LOGIN PASSWORD
        public void ChangePassword(string user, string pass)
        {
            SqlCommand cmd = new SqlCommand("UPDATE tbl_user SET password='******' WHERE userName='******'", ConnectionDB.connection());

            cmd.ExecuteNonQuery();
        }
예제 #4
0
        private void txtChildEdu_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (LoadBtnCheck == true)
                {
                    if (txtChildEdu.Text != "")
                    {
                        string query = string.Empty;
                        foreach (string s in checkedListBox1.CheckedItems)
                        {
                            query += s + ",";
                        }
                        query = query.Remove(query.Length - 1, 1);
                        string sql = string.Format("SELECT {0} FROM tbl_cbrdata", query);
                        if (ConnectionDB.connection().State == ConnectionState.Closed)
                        {
                            ConnectionDB.connection().Open();
                        }
                        SqlCommand cmd = new SqlCommand(sql, ConnectionDB.connection())
                        {
                            CommandType = CommandType.Text
                        };
                        SqlDataAdapter sda = new SqlDataAdapter(cmd);
                        DataTable      dt  = new DataTable();
                        sda.Fill(dt);
                        dgvDataList.DataSource = dt;

                        DataView dv = new DataView(dt);
                        dv.RowFilter           = "child_in_edu LIKE '%" + txtChildEdu.Text + "%'";
                        dgvDataList.DataSource = dv;
                        ConnectionDB.connection().Close();//Close DB Connection
                    }
                    else
                    {
                        checkedDataLoad();
                    }
                }
                else
                {
                    SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM tbl_cbrdata", ConnectionDB.connection());
                    DT = new DataTable();
                    da.Fill(DT);
                    BindingSource bnsue = new BindingSource();
                    bnsue.DataSource       = DT;
                    dgvDataList.DataSource = bnsue;
                    da.Update(DT);

                    DataView dv = new DataView(DT);
                    dv.RowFilter           = "child_in_edu LIKE '%" + txtChildEdu.Text + "%'";
                    dgvDataList.DataSource = dv;
                    ConnectionDB.connection().Close();//Close DB Connection
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thlis column is not selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtChildEdu.Clear();
            }
        }