学生成绩管理系统课程设计源程序.docx

上传人:b****1 文档编号:135260 上传时间:2023-04-28 格式:DOCX 页数:47 大小:20.89KB
下载 相关 举报
学生成绩管理系统课程设计源程序.docx_第1页
第1页 / 共47页
学生成绩管理系统课程设计源程序.docx_第2页
第2页 / 共47页
学生成绩管理系统课程设计源程序.docx_第3页
第3页 / 共47页
学生成绩管理系统课程设计源程序.docx_第4页
第4页 / 共47页
学生成绩管理系统课程设计源程序.docx_第5页
第5页 / 共47页
学生成绩管理系统课程设计源程序.docx_第6页
第6页 / 共47页
学生成绩管理系统课程设计源程序.docx_第7页
第7页 / 共47页
学生成绩管理系统课程设计源程序.docx_第8页
第8页 / 共47页
学生成绩管理系统课程设计源程序.docx_第9页
第9页 / 共47页
学生成绩管理系统课程设计源程序.docx_第10页
第10页 / 共47页
学生成绩管理系统课程设计源程序.docx_第11页
第11页 / 共47页
学生成绩管理系统课程设计源程序.docx_第12页
第12页 / 共47页
学生成绩管理系统课程设计源程序.docx_第13页
第13页 / 共47页
学生成绩管理系统课程设计源程序.docx_第14页
第14页 / 共47页
学生成绩管理系统课程设计源程序.docx_第15页
第15页 / 共47页
学生成绩管理系统课程设计源程序.docx_第16页
第16页 / 共47页
学生成绩管理系统课程设计源程序.docx_第17页
第17页 / 共47页
学生成绩管理系统课程设计源程序.docx_第18页
第18页 / 共47页
学生成绩管理系统课程设计源程序.docx_第19页
第19页 / 共47页
学生成绩管理系统课程设计源程序.docx_第20页
第20页 / 共47页
亲,该文档总共47页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

学生成绩管理系统课程设计源程序.docx

《学生成绩管理系统课程设计源程序.docx》由会员分享,可在线阅读,更多相关《学生成绩管理系统课程设计源程序.docx(47页珍藏版)》请在冰点文库上搜索。

学生成绩管理系统课程设计源程序.docx

学生成绩管理系统课程设计源程序

关于About.cs

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Reflection;

namespace学生成绩管理系统

{

publicpartialclassAbout:

Form

{

publicAbout()

{

InitializeComponent();

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

this.Close();

}

privatevoidAbout_Load(objectsender,EventArgse)

{

}

}

}

添加课程信息AddCourse.cs

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingMySql.Data.MySqlClient;

namespace学生成绩管理系统

{

publicpartialclassAddCourse:

Form

{

publicAddCourse()

{

InitializeComponent();

}

privatevoidbtnExit_Click(objectsender,EventArgse)

{

this.Close();

}

privatevoidbtnAddCourse_Click(objectsender,EventArgse)

{

stringmyConnectionString="Database=student;DataSource=localhost;UserId=root;Password=k6smile20xq";

MySqlConnectionmycn=newMySqlConnection(myConnectionString);

mycn.Open();

stringsql;

Coursecourse=newCourse();

course.Cno=txtCno.Text;

course.Cname=txtCname.Text;

try

{

sql="selectcount(*)fromcoursewherecno='"+txtCno.Text+"'";

MySqlCommandmycm=newMySqlCommand(sql,mycn);

MySqlDataReadermsdr=mycm.ExecuteReader();

msdr.Read();

intstuCount=msdr.GetInt32("count(*)");

msdr.Close();

if(stuCount==0&&txtCname.Text!

=""&&txtCno.Text!

="")

{

sql="insertintocourse(cno,cname)values('"+course.Cno+"','"+course.Cname+"')";

MySqlCommandmycm1=newMySqlCommand(sql,mycn);

try

{

mycm1.ExecuteNonQuery();

}

catch(Exceptionexception)

{

MessageBox.Show(exception.Message);

return;

}

finally

{

mycn.Close();

}

MessageBox.Show("添加成功!

");

}

elseif(stuCount>=1&&txtCno.Text!

=""&&txtCname.Text!

="")

{

//这里需要关闭资源

MessageBox.Show("该课程的信息已存在,请重新输入!

");

}

else

{

//这里需要关闭资源

MessageBox.Show("请输入要添加的信息");

msdr.Close();

mycn.Close();

}

}

catch(Exceptiona)

{

Console.WriteLine(a.ToString());

}

finally

{

txtCno.Text="";

txtCname.Text="";

 

}

}

privatevoidAddCourse_Load(objectsender,EventArgse)

{

}

}

}

添加学生信息AddStudent.cs

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingMySql.Data.MySqlClient;

 

usingSystem.IO;

namespace学生成绩管理系统

{

publicpartialclassAddStudent:

Form

{

publicAddStudent()

{

InitializeComponent();

}

privatevoidAddStudent_Load(objectsender,EventArgse)

{

}

privatevoidbtnCancel_Click(objectsender,EventArgse)

{

this.Close();

}

privatevoidbtnAddStudent_Click(objectsender,EventArgse)

{

stringmyConnectionString="Database=student;DataSource=localhost;UserId=root;Password=k6smile20xq";

MySqlConnectionmycn=newMySqlConnection(myConnectionString);

mycn.Open();

stringsql;

//intstuNum=Selectcount(id)from

Studentstu=newStudent();

stu.Sno=txtSno.Text;

stu.Sname=txtName.Text;

stu.Age=txtAge.Text;

stu.ClassName=txtClassName.Text;

stu.Password=txtPassword.Text;

stu.Id=txtId.Text;

if(rbStuGirl.Checked)stu.Sex="女?

";

elseif(rbStuBoy.Checked)stu.Sex="男D";

//if(rbStuGirl.Checked)stu.Sex="girl";

//elseif(rbStuBoy.Checked)stu.Sex="boy";

 

try

{

sql="selectcount(*)fromstudentwheresno='"+txtSno.Text+"'";

MySqlCommandmycm=newMySqlCommand(sql,mycn);

MySqlDataReadermsdr=mycm.ExecuteReader();

msdr.Read();

intstuCount=msdr.GetInt32("count(*)");

msdr.Close();

if(stuCount==0&&txtSno.Text!

=""&&txtName.Text!

=""&&txtAge.Text!

=""&&txtClassName.Text!

=""&&txtPassword.Text!

=""&&txtId.Text!

="")

{

sql="insertintostudent(sno,sname,sex,age,classname,password,id)values('"+stu.Sno+"','"+stu.Sname+"','"+stu.Sex+"','"+stu.Age+"','"+stu.ClassName+"','"+stu.Password+"','"+stu.Id+"')";

Console.WriteLine(sql);

MySqlCommandmycm1=newMySqlCommand(sql,mycn);

try

{

mycm1.ExecuteNonQuery();

}catch(Exceptionexception)

{

MessageBox.Show(exception.Message);

return;

}

finally

{

msdr.Close();

mycn.Close();

}

MessageBox.Show("添?

¨?

加¨?

成¨?

功|!

ê?

");

}

elseif(stuCount>=1&&txtSno.Text!

=""&&txtName.Text!

=""&&txtAge.Text!

=""&&txtClassName.Text!

=""&&txtPassword.Text!

=""&&txtId.Text!

="")

{

//这里需要关闭资源

MessageBox.Show("该学生的信息已存在");

}

else

{

//这里需要关闭资源

MessageBox.Show("请输入要添加的信息");

msdr.Close();

mycn.Close();

}

}

catch(Exceptiona)

{

Console.WriteLine(a.ToString());

}finally

{

txtSno.Text="";

txtName.Text="";

txtAge.Text="";

txtClassName.Text="";

txtPassword.Text="";

txtId.Text="";

}

}

  }

  }

 主窗口程序AdminWindou.cs

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

 

namespace学生成绩管理系统

{

publicpartialclassAdminWindow:

Form

{

publicAdminWindow()

{

InitializeComponent();

}

privatevoidAdminWindow_Load(objectsender,EventArgse)

{

}

 

privatevoid查询学生信息ToolStripMenuItem2_Click(objectsender,EventArgse)

{

newSearchStudent().ShowDialog();

}

privatevoid添加学生信息ToolStripMenuItem3_Click(objectsender,EventArgse)

{

newAddStudent().ShowDialog();

}

privatevoid修改学生信息ToolStripMenuItem3_Click(objectsender,EventArgse)

{

newUpdateStudent().ShowDialog();

}

privatevoid删除学生信息ToolStripMenuItem3_Click(objectsender,EventArgse)

{

newDeleteStudent().ShowDialog();

}

privatevoid查询课程信息ToolStripMenuItem2_Click(objectsender,EventArgse)

{

newSearchCourse().ShowDialog();

}

privatevoid添加课程信息ToolStripMenuItem3_Click(objectsender,EventArgse)

{

newAddCourse().ShowDialog();

}

privatevoid修改学生信息ToolStripMenuItem3_Click(objectsender,EventArgse)

{

newUpdateCourse().ShowDialog();

}

privatevoid删除课程信息ToolStripMenuItem3_Click(objectsender,EventArgse)

{

newDeleteCourse().ShowDialog();

}

privatevoid关于ToolStripMenuItem2_Click(objectsender,EventArgse)

{

newAbout().ShowDialog();

}

privatevoid退出系统ToolStripMenuItem2_Click(objectsender,EventArgse)

{

Application.Exit();

}

privatevoid排名ToolStripMenuItem1_Click(objectsender,EventArgse)

{

newCourseRank().ShowDialog();

}

privatevoid查询学生成绩ToolStripMenuItem2_Click(objectsender,EventArgse)

{

newScoreSearch().ShowDialog();

}

privatevoid各班平均分ToolStripMenuItem2_Click(objectsender,EventArgse)

{

newClassAvg().ShowDialog();

}

privatevoid各科平均分ToolStripMenuItem2_Click(objectsender,EventArgse)

{

newCourseAvg().ShowDialog();

}

}

}

班级平均成绩查询ClassAvg.cs

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingMySql.Data.MySqlClient;

namespace学生成绩管理系统

{

publicpartialclassClassAvg:

Form

{

publicClassAvg()

{

InitializeComponent();

}

privatevoidClassAvg_Load(objectsender,EventArgse)

{

}

privatevoidbtnsearch_Click(objectsender,EventArgse)

{

stringbjmc=txtbjmc.Text;

using(MySqlConnectionconn=newMySqlConnection(@"Database=student;DataSource=localhost;UserId=root;Password=k6smile20xq"))

{

conn.Open();

using(MySqlCommandcmd=conn.CreateCommand())

{

cmd.CommandText=@"selectavg(score)fromscoreinfi

whereclassname=@bjmc";

cmd.Parameters.Add(newMySqlParameter("bjmc",bjmc));

stringbjavg=Convert.ToString(cmd.ExecuteScalar());

txtbjavg.Text=bjavg;

}

}

}

privatevoidbtncancle_Click(objectsender,EventArgse)

{

this.Close();

}

}

}

单科平均成绩CourseAvg.cs

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingMySql.Data.MySqlClient;

namespace学生成绩管理系统

{

publicpartialclassCourseAvg:

Form

{

publicCourseAvg()

{

InitializeComponent();

}

privatevoidbtnquery_Click(objectsender,EventArgse)

{

stringcourseid=txtcourseid.Text;

stringcoursename=txtcoursename.Text;

using(MySqlConnectionconn=newMySqlConnection(@"Database=student;DataSource=localhost;UserId=root;Password=k6smile20xq"))

{

conn.Open();

using(MySqlCommandcmd=conn.CreateCommand())

{

cmd.CommandText=@"selectavg(score)asavgfromscoreinfi

wherecname=@coursename";

cmd.Parameters.Add(newMySqlParameter("coursename",coursename));

/*DataSetdataset=newDataSet();

MySqlDataAdapteradapter=newMySqlDataAdapter(cmd);

adapter.Fill(dataset);

DataTabletable=dataset.Tables[0];

for(inti=0;i

{

DataRowrow=table.Rows[i];

txtavg.Text=Convert.ToString(row["avg"]);

}*/

txtavg.Text=Convert.ToString(cmd.ExecuteScalar());

}

}

}

privatevoidCourseAvg_Load(objectsender,EventArgse)

{

}

privatevoidbtnexit_Click(objectsender,EventArgse)

{

this.Close();

}

}

}

单科成绩排名CourseRank.cs

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingMySql.Data.MySqlClient;

namespace学生成绩管理系统

{

publicpartialclassCourseRank:

Form

{

publicCourseRank()

{

InitializeComponent();

}

privatevoidForm1_Load(objectsender,EventArgse)

{

//this

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2