软件工程课程设计报告2013(7)

2018-12-17 10:49

后 delete from Course where cno = ‘当前选中行的课号’;

DialogResult result = MessageBox.Show(\是否删除此记录并删除对应成绩表相关内容?\提示!\

if (result == DialogResult.Yes) {

string Sql = \from sc where cno = '\+ this.dataGridView[0,

this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \

DataAccess DA = new DataAccess(); DA.ExeSQL(Sql);

string SqlText = \

this.dataGridView[0,

this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \

DA = new DataAccess(); DA.ExeSQL(SqlText);

MessageBox.Show(\删除成功!\ this.DBDataGrid(); }

if (result == DialogResult.No) {

return; }

⑤添加完新课程可以向课程中添加学生

用到的sql语句:

insert into sc(sno,cno) values ('学号','课号');//不插入成绩

单条添加:添加选中行的学生。 全部添加:添加表中全部学生。 if (this.dataGridView.Rows.Count != 0) {

string Sql = \* from sc where sno = '\+

this.dataGridView[0, this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \

DataAccess DA = new DataAccess(); if (DA.IsRead(Sql) == false) {

DA = new DataAccess();

string SqlText = \+

this.dataGridView[0,

+

\

+

this.dataGridView.CurrentCellAddress.Y].Value.ToString() this.textBox_cno.Text.Trim() + \

MessageBox.Show(\添加成功!\ } else {

MessageBox.Show(\学号为\+ this.dataGridView[0, this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \的学生已在该班级中\

} }

4)、成绩管理界面

(1)查询过程通过Student表和Sc表连接起来进行操作 用到的sql语句:

select student.sno as 学生编号,sname as 学生姓名,sc.cno as 课程号,cname as 课程名,grade as 成绩 from student , course , sc where student.sno=sc.sno and sc.cno=course.cno and student.sno like '学号%' and student.sname like '%姓名%'and course.cname like '%课程名\and student.sdept like'%系别%'and course.cno like '%课号%';

string SqlText = \student.sno as 学生编号,sname as 学生姓名,sc.cno as 课程号,cname as 课程名,grade as 成绩 from student , course , sc where student.sno=sc.sno and sc.cno=course.cno and student.sno like '\+ this.textBox_sno.Text.Trim() + \and student.sname like '%\+ this.textBox_sname.Text.Trim()

+

\

course.cname

like

'%\

+

this.text_cname.Text.Trim() + \and student.sdept like '%\+ this.text_dept.Text.Trim()

+

\

course.cno

like

'%\

+

this.textBox_cno.Text.Trim() + \

DataAccess DA = new DataAccess(); this.dt = DA.ExeSQLdt(SqlText);

this.dataGridView.DataSource = this.dt.DefaultView; this.cm = (CurrencyManager)BindingContext[this.dt]; dataGridView.Columns[\课程号\

dataGridView.Columns[\学生编号\ dataGridView.Columns[\学生姓名\ dataGridView.Columns[\课程名\ if (this.dataGridView.Rows.Count != 0) {

for (int i = 0; i < this.dataGridView.Rows.Count; ) {

this.dataGridView.Rows[i].DefaultCellStyle.BackColor System.Drawing.Color.Pink;

i += 2; } }

(2)删除、修改操作只对Sc表成绩或整条数据有影响 用到的sql语句:

delete from sc where sno='学号' and cno = '课号';

update sc set grade = 新成绩 where cno = '课号' and sno = '学号';

=

if (this.dataGridView.Rows.Count != 0) {

for (int i = 0; i < this.dataGridView.Rows.Count-1;i++ ) {

if (this.dataGridView[4, i].Value.ToString() != \ {

DataAccess DA = new DataAccess();

string SqlText = \sc set grade = \+ int.Parse(this.dataGridView[4, i].Value.ToString()) + \where cno = '\+ this.dataGridView[2, i].Value.ToString() + \and sno = '\+ this.dataGridView[0, i].Value.ToString() + \

DA.ExeSQL(SqlText); } else {

DataAccess DA = new DataAccess();


软件工程课程设计报告2013(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:最新社会工作综合能力试题及答案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: