欢迎来到天天文库
浏览记录
ID:35351746
大小:82.33 KB
页数:32页
时间:2019-03-23
《学生成绩管理系统课程设计源程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、关于About.csusingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Reflection;namespace学生成绩管理系统{publicpartialclassAbout:Form{publicAbout(){Initia
2、lizeComponent();privatevoidbuttonl_C1ick(objectsender,EvenlArgse){this.Close();}privatevoidAbout_Load(objectsender,EventArgse)}}添加课程信息AddCourse.csusingSystem;usingSystem.Colledions.Generic;usingSystem.ComponentModel;usingSystem・Dst3;usingSystem.Drawing;usingSystem.Lin
3、q;usingSystem.Text;usingSystem.Windows.Forms;usingMySql.Data.MySqlClient;namespace学生成绩管理系统publicpartialclassAddCourse:Form{publicAddCourse(){InitializeComponent();}privatevoidbtnExitClick(objectsender,EventArgse){this.Close();}privatevoidbtnAddCourseClick(objectsender
4、,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;t
5、ry{sql="selectcount(*)fromcoursewherecno=,"+txtCno.Text+MySqlCommandmycm=newMySqlCommand(sql,mycn);MySq1DataReadermsdr=mycm・ExecuteReader();msdr.Read();intstuCount二msdr.Getlnt32("count(*)〃);msdr.CloseO;if(stuCount==0&&txtCname.Text!=&&txtCno.Text!="”){sql=〃insertintoc
6、ourse(eno,cname)valuesC,z+course.Cno++course.Cname+MySqlCommandmycml=newMySqlCommand(sql,mycn);trymycm1・ExecutcNonQuery();}catch(Except!onexception){MessageBox.Show(exception.Message);return;}final1y{mycn.Close();}MessageBox.ShowC添加成功!“);}elseif(stuCount>=1&&txtCno.Te
7、xt!=&&txtCname.Text!="“){//这里需要关闭资源MessageBox.Show(/Z该课程的信息己存在,请重新输入!");}else{//这里需要关闭资源MessageBox.Show(”请输入要添加的信息");msdr.CloseO;mycn.Close();})catch(Exceptiona){Console.WriteLine(a.ToStringO);}finally{txtCno.Text二"“;txtCname.Text二privatevoidAddCourse_Load(objectsende
8、r,EvontArgse)添加学半信息AddStudent.csusingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usin
此文档下载收益归作者所有