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(); }
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"; } }
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"; } }