コード例 #1
0
        private void btn_cidsearch_Click(object sender, EventArgs e)
        {
            label_avg.Text = "";
            label_min.Text = "";
            label_num.Text = "";
            label_max.Text = "";
            string cid = cbox_cid.Text.Trim();

            if (cid == "")
            {
                this.info_data.DataSource = Ad_ChooseManage.Query("select * from choices where cid in (select cid from costea where tid = '" + tid + "')").Tables["choices"];
            }
            else
            {
                this.info_data.DataSource = Ad_ChooseManage.Query("select * from choices where cid = '" + cid + "' and '" + cid + "' in ( select cid from costea where tid = '" + tid + "')").Tables["choices"];
                if (this.info_data.RowCount == 0)
                {
                    label_avg.Text = "0";
                    label_min.Text = "0";
                    label_num.Text = "0";
                    label_max.Text = "0";
                }
                statistics_1(cid);
            }
        }
        private void btn_choose_Click(object sender, EventArgs e)
        {
            Ad_ChooseManage childrenForm = new Ad_ChooseManage(this);

            childrenForm.Owner = this;
            this.Hide();
            childrenForm.Show();
        }
        public Ad_AddRecord(Ad_ChooseManage parent)
        {
            InitializeComponent();
            pform = parent;

            string sql1 = "select distinct cterm from choices";

            if (Ad_ChooseManage.ExecuteSql(sql1) != 0)
            {
                this.cbox_term.DataSource = Ad_ChooseManage.Query(sql1).Tables["choices"];
                cbox_term.DisplayMember   = "cterm";
            }
        }
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string newsid = tbox_sid.Text.Trim();
            string newcid = tbox_cid.Text.Trim();
            string cterm  = cbox_term.Text;
            string cscore = tbox_score.Text.Trim();
            string istrue = cbox_repeat.Text;
            string sql    = "update choices set sid = '" + newsid + "',cid='" + newcid + "',cterm=" + int.Parse(cterm) + ",cscore=" + int.Parse(cscore) + ",istrue='" + istrue + "' where sid = '" + oldsid + "' and cid = '" + oldcid + "'";

            if (Ad_ChooseManage.ExecuteSql(sql) != 0)
            {
                MessageBox.Show("修改成功!");
            }
            this.pform.Show();
            this.Close();
        }
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string sid    = tbox_sid.Text.Trim();
            string cid    = tbox_cid.Text.Trim();
            string cterm  = cbox_term.Text;
            string cscore = tbox_score.Text.Trim();
            string istrue = cbox_repeat.Text;
            string sql    = "insert into choices(sid,cid,cterm,cscore,istrue) values('" + sid + "','" + cid + "'," + int.Parse(cterm) + "," + int.Parse(cscore) + ",'" + istrue + "')";

            if (Ad_ChooseManage.ExecuteSql(sql) != 0)//向源数据库传递并执行SQL语句
            {
                MessageBox.Show("选课信息添加成功!");
            }
            this.pform.Show();
            this.Close();
        }
コード例 #6
0
        private void btn_sidsearch_Click(object sender, EventArgs e)
        {
            label_avg.Text = "";
            label_min.Text = "";
            label_num.Text = "";
            label_max.Text = "";
            string sid = tbox_sid.Text.Trim();

            if (sid == "")
            {
                this.info_data.DataSource = Ad_ChooseManage.Query("select * from choices where cid in ( select cid from costea where tid = '" + tid + "')").Tables["choices"];
            }
            else
            {
                this.info_data.DataSource = Ad_ChooseManage.Query("select * from choices where sid = '" + sid + "' and cid in ( select cid from costea where tid = '" + tid + "')").Tables["choices"];
            }
        }
        public Ad_UpdateRecord(Ad_ChooseManage parent, string sid, string cid, string cterm, string csore, string istrue)
        {
            InitializeComponent();
            pform            = parent;
            tbox_sid.Text    = sid;
            tbox_cid.Text    = cid;
            cbox_term.Text   = cterm;
            tbox_score.Text  = csore;
            cbox_repeat.Text = istrue;
            oldsid           = sid;
            oldcid           = cid;

            string sql1 = "select distinct cterm from choices";

            if (Ad_ChooseManage.ExecuteSql(sql1) != 0)
            {
                this.cbox_term.DataSource = Ad_ChooseManage.Query(sql1).Tables["choices"];
                cbox_term.DisplayMember   = "cterm";
            }
        }
コード例 #8
0
        public Stu_Search(LoginIn_Stu parent, string id)
        {
            InitializeComponent();
            pform = parent;
            sid   = id;
            string sql = "select distinct cid from choices where sid = '" + sid + "'";


            if (Ad_ChooseManage.ExecuteSql(sql) != 0)
            {
                this.cbox_cid.DataSource = Ad_ChooseManage.Query(sql).Tables["choices"];
                cbox_cid.DisplayMember   = "cid";
            }

            string sql1 = "select distinct cterm from choices where sid = '" + sid + "'";


            if (Ad_ChooseManage.ExecuteSql(sql1) != 0)
            {
                this.cbox_term.DataSource = Ad_ChooseManage.Query(sql1).Tables["choices"];
                cbox_term.DisplayMember   = "cterm";
            }
        }