Esempio n. 1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            DAO.OpenConnection();
            string sql;

            if (cmbMaDoi.Text.Length == 0)
            {
                MessageBox.Show("Ban chua nhap ma doi");
                cmbMaDoi.Focus();
                return;
            }
            if (txtMaSan.Text == "")
            {
                MessageBox.Show("Ban chua nhap ma san");
                txtMaSan.Focus();
                return;
            }

            if (txtTenDoi.Text == "")
            {
                MessageBox.Show("Ban chua nhap ten doi");
                txtTenDoi.Focus();
                return;
            }

            if (txtHLV.Text == "")
            {
                MessageBox.Show("Ban chua nhap ten HLV");
                txtHLV.Focus();
                return;
            }

            if (txtMaTinh.Text == "")
            {
                MessageBox.Show("Ban chua nhap ma tinh");
                txtMaTinh.Focus();
                return;
            }

            /*if (txtLogo.Text.Trim().Length == 0)
             * {
             *  MessageBox.Show("Ban chua nhap Logo");
             *  txtLogo.Focus();
             *  return;
             * }*/
            /*if (txtLogo.Text == "")
             * {
             *  MessageBox.Show("Bạn cần nhập logo!");
             *  txtLogo.Focus();
             *  return;
             * }*/

            sql = "Select madoi from doibong where madoi = '"
                  + cmbMaDoi.Text + " ' ";


            if (DAO.checkKeyExit(sql))
            {
                MessageBox.Show("Ma doi da ton tai");

                cmbMaDoi.Focus();
                cmbMaDoi.Text = "";
                return;
            }
            else
            {
                sql = "insert into doibong (madoi,tendoi,masan,HLV,matinh,diem,sobanthang,sobanthua,soluongcauthu) " +
                      "values (' " +
                      cmbMaDoi.Text + "', N'" +
                      txtTenDoi.Text.Trim() + "', N'" +
                      txtMaSan.Text.Trim() + "' , N'" +
                      txtHLV.Text.Trim() + "', N'" +
                      txtMaTinh.Text.Trim() + "',null,null,null,null)";
                /*txtLogo.Text + "', N'" + ")"*/
                MessageBox.Show(sql);

                DAO.LoadDataToTable(sql);
                DAO.CloseConnetion();
                LoadDataToGriview();
            }
        }
 private void FrmTrandau_The_Load(object sender, EventArgs e)
 {
     DAO.OpenConnection();
     LoadDataToGrivew();
     DAO.CloseConnetion();
 }
 private void FrmCapNhatCT_Load(object sender, EventArgs e)
 {
     DAO.OpenConnection();
     LoadDataToGrivew();
     DAO.CloseConnetion();
 }