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

2018-12-17 10:49

tring SqlText = \学生编号,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; } } ②增加操作

用到的sql语句:

insert into course values ('课号','课程名','先行课号','学分');或insert into course(cno,cname,ccredit) values ('课号','课程名','学分');

=

if (textBox_cno.Text != \&& textBox_ccredit.Text != \&&

textBox_cname.Text != \

{

string SqlText = \ SqlText += \ DataAccess DA = new DataAccess(); if (DA.IsRead(SqlText) == false) {

if (this.textBox_cpno.Text != \ {

SqlText = \ SqlText += \

+ this.textBox_cname.Text.Trim() + \

SqlText += int.Parse(this.textBox_cpno.Text.Trim()) +

\

DA = new DataAccess(); if (DA.ExeSQL(SqlText) == 1) {

DialogResult result = MessageBox.Show(\新增课程

成功!是否返回课程表?\提示!\

MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) {

_013student.FormCourse.formcourse.DBDataGrid();

this.Close(); }

if (result == DialogResult.No) {

return; } } } else {

SqlText = \values (\

SqlText += \\

SqlText += this.textBox_ccredit.Text.Trim() + \

DA = new DataAccess(); if (DA.ExeSQL(SqlText) == 1) {

// MessageBox.Show(\新增课程成功!\ DialogResult result = MessageBox.Show(\新增课程

成功!是否返回课程表?\\提示!\MessageBoxButtons.YesNo, MessageBoxIcon.Question);

if (result == DialogResult.Yes) {

_013student.FormCourse.formcourse.DBDataGr

id();

this.Close(); }

if (result == DialogResult.No) {

return; } } } } else {

MessageBox.Show(\课程号已存在请重新输入\ } } else {

MessageBox.Show(\课程号、课程名或学分不能为空\ } }

③修改操作

用到的sql语句:

update course set cname = '修改后的课程名' , cpno = '先行课号' ,ccredit = '学分'where cno = '当前选中行的课号';

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

DataAccess DA = new DataAccess();

string SqlText = \course set cname = '\

+this.dataGridView[1,this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \, cpno = '\+ this.dataGridView[2,this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \,ccredit = '\+ this.dataGridView[3,this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \cno = '\+ this.dataGridView[0,this.dataGridView.CurrentCellAddress.Y].Value.ToString() + \

DA.ExeSQL(SqlText);

MessageBox.Show(\修改成功!\ this.DBDataGrid(); }

④删除操作

用到的sql语句:

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


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

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

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

马上注册会员

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