概述
本套学生成绩系统主要包括以下四个能模功块,具体功能要求如下:
1、登录模块
登录模块提供用户登录界面,用户输入正确的用户名和密码后,则可进入系统主窗口(即导航页面),从而可以选择进入相应的子系统。
2、学生信息模块
学生信息模块主要用户管理学生的基本信息,包括学号、姓名、性别、年龄和所在系,能对学生信息进行添加、删除和修改等操作。
3、课程信息模块
课程信息模块主要用于管理课程信息,包括课程号、课程名、学分和学时,能对课程信息进行添加、删除和修改等操作。
4、成绩信息模块
成绩信息模块主要用于管理学生成绩的录入及查询。
数据库设计:
基于SQL Server2008数据库管理系统构建数据库SelectCourse,根据作业题目要求共设计实现了四张表,分别是系统用户表tbl_User、学生信息表tbl_Student、课程信息表tbl_Course以及成绩信息表tbl_SC,其表结构如下。
1、系统用户表
系统用户表“tbl_User”用于存放系统用户的相关数据。其结构如表1-1所示。
表1-1 系统用户表
列名 | 说明 | 数据类型 | 约束 |
userName | 用户名 | 字符串,长度为16 | 主键 |
userPassword | 用户密码 | 字符串,长度为16 | 非空 |
userPurview | 权限 | 字符串,长度为16 | 取值为“超级用户”、 “一般用户” |
2、学生信息表
学生信息表“tbl_Student”结构如表1-2所示。
表1-2 学生信息表
列名 | 说明 | 数据类型 | 约束 |
Sno | 学号 | 字符串,长度为10 | 主键 |
Sname | 姓名 | 字符串,长度为8 | 非空 |
Ssex | 性别 | 字符串,长度为2 | |
Sage | 年龄 | 整数 | - |
Sdept | 所在系 | 字符串,长度为20 | - |
3、课程信息表
课程信息表“tbl_Course”结构如表1-3所示。
表1-3 课程信息表
列名 | 说明 | 数据类型 | 约束 |
Cno | 课程号 | 字符串,长度为10 | 主键 |
Cname | 课程名 | 字符串,长度为20 | 非空 |
Ccredit | 学分 | 整数 | - |
Csemester | 学期 | 整数 | - |
Cperiod | 学时 | 整数 | - |
4、成绩信息表
成绩信息表“tbl_SC”结构如表1-4所示。
表1-4 成绩信息表
列名 | 说明 | 数据类型 | 约束 |
Sno | 学号 | 字符串,长度为10 | 主键 |
Cno | 课程号 | 字符串,长度为10 | 主键 |
grade | 成绩 | 整数 |
公共类设计:
DataBase:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public class DataBase
{
SqlConnection dataConnection = new SqlConnection();
SqlDataAdapter dataAdapter;
DataSet dataSet;
SqlCommand command;
static string connstr ="server=.;database=SelectCourse; integrated security=true;";
public DataSet GetDataFormDB(string sqlStr)
{
try
{
dataConnection.ConnectionString = connstr;
dataConnection.Open();
dataAdapter = new SqlDataAdapter(sqlStr, connstr);
dataSet = new DataSet();
dataAdapter.Fill(dataSet);
dataConnection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
dataConnection.Close();
}
if (dataSet.Tables[0].Rows.Count != 0)
{
return dataSet;
}
else
{
return null;
}
}
public bool UpdateDB(string sqlStr)
{
try
{
dataConnection.ConnectionString = connstr;
dataConnection.Open();
command = new SqlCommand(sqlStr, dataConnection);
command.ExecuteNonQuery();
dataConnection.Close();
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
}
}
ClassShared:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApplication4
{
public class ClassShared
{
public static string[] userInfo = new string[2];
}
public class LoginUser
{
public static string _userName;
public static string _userPassword;
public static string _userPurview;
}
}
系统窗体设计及功能代码编写:
登陆窗体代码实现:
namespace WindowsFormsApplication4
{
//ComboBox1=txtUserName
//ComboBox2=txtUserPassword
//Button1=btnOk
//Button2=btnClose
public partial class frmlogin : Form
{
public frmlogin()
{
InitializeComponent();
}
private void btnOk_Click(object sender, EventArgs e)//点击确定后发生事件
{
try
{
DataSet ds = new DataSet();
DataBase db = new DataBase();
string sqlStr = "Select userPassword,userPurview from tbl_User where UserName = '" + txtUserName.Text.Trim() + "'";
ds = db.GetDataFormDB(sqlStr);
if (ds.Tables[0].Rows[0].ItemArray[0].ToString() == txtUserPassword.Text.Trim())
{
frmMain ob_FrmMain = new frmMain();
ClassShared.userInfo[0] = txtUserName.Text.Trim();
ClassShared.userInfo[1]=ds.Tables[0].Rows[0].ItemArray[1].ToString();
ob_FrmMain.Show();
this.Hide();
}
else
{
MessageBox.Show("用户名或密码错误,请重新输入!");
txtUserName.Text = "";
txtUserPassword.Text = "";
txtUserName.Focus();
}
}
catch
{
MessageBox.Show("用户名或者密码错误", "错误");
}
}
private void btnClose_Click(object sender, EventArgs e)// 点击取消后事件
{
Application.Exit();
}
}
}
主窗体界面代码实现:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication4
{ //button1=btnStudent
//button2=btnCourse
//button3=btnSC
//button4=btnClose
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void frmMain_Load(object sender, EventArgs e)
{
//将“userInfo[]”中保存的用户登录信息作为标题显示在窗体的标题栏中
this.Text = ClassShared.userInfo[0] + "--" + ClassShared.userInfo[1];
if (ClassShared.userInfo[1] == "一般用户")
{
btnStudent.Enabled = false;
btnCourse.Enabled = false;
}
else
{
btnStudent.Enabled = true;
btnCourse.Enabled = true;
}
}
private void btnClose_Click(object sender, EventArgs e)//退出系统
{
Application.Exit();
}
private void btnStudent_Click(object sender, EventArgs e)//进入学生管理系统
{
frmStudent ob_FrmStudent = new frmStudent();
ob_FrmStudent.Show();
}
private void btnCourse_Click(object sender, EventArgs e)//进入课程信息管理
{
frmCourse ob_FrmCourse = new frmCourse();
ob_FrmCourse.Show();
}
private void btnSc_Click(object sender, EventArgs e)//进入成绩系信息管理
{
frmSC ob_FrmSC = new frmSC();
ob_FrmSC.Show();
}
}
}
学生信息管理代码实现:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication4
{
//TextBox1=SNumber
//TextBox2=SName
//TextBox3=SAge
//TextBox4=SYuanXi
//ComboBox1=SSex
//Button1=btnAdd
//Button2=btnUpadate
//Button3=btnDelete
//Button4=btnClose
public partial class frmStudent : Form
{
void objOpen()
{
SNumber.Enabled = true;
SName.Enabled = true;
SAge.Enabled = true;
SSex.Enabled = true;
SYuanXi.Enabled = true;
SNumber.Focus();
}
void objClose()
{
SNumber.Enabled = false;
SName.Enabled = false;
SAge.Enabled = false;
SSex.Enabled = false;
SYuanXi.Enabled = false;
}
void Clear()
{
SNumber.Text = "";
SName.Text = "";
SAge.Text = "";
SSex.SelectedIndex = -1;
SYuanXi.Text = "";
}
void SetHeaderText()//给每列标注列名
{
dgrdvStudent.Columns[0].HeaderText = "学号";
dgrdvStudent.Columns[1].HeaderText = "姓名";
dgrdvStudent.Columns[2].HeaderText = "性别";
dgrdvStudent.Columns[3].HeaderText = "年龄";
dgrdvStudent.Columns[4].HeaderText = "所在系";
}
void RefreshData()//用于刷新数据的方法
{
string comStr;
DataBase db = new DataBase();
DataSet ds = new DataSet();
comStr = "select * from tbl_Student";
ds = db.GetDataFormDB(comStr);
if (ds == null)
{
MessageBox.Show("没有任何学生记录!");
}
else
{
dgrdvStudent.DataSource = ds.Tables[0];
SetHeaderText();
}
}
public frmStudent()
{
InitializeComponent();
}
private void frmStudent_Load(object sender, EventArgs e)
{
//添加SSex的选项
SSex.Items.Add("男");
SSex.Items.Add("女");
objClose();
RefreshData();
}
private void dgrdvStudent_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
int n = this.dgrdvStudent.CurrentCell.RowIndex;
SNumber.Text = this.dgrdvStudent[0, n].Value.ToString();
SName.Text = this.dgrdvStudent[1, n].Value.ToString();
SSex.SelectedItem = this.dgrdvStudent[2, n].Value.ToString();
SAge.Text = this.dgrdvStudent[3, n].Value.ToString();
SYuanXi.Text = this.dgrdvStudent[4, n].Value.ToString();
}
//用户单击【添加】按钮,则窗体上方的文本框和组合框都返回可用状态,同时该按钮上的文本变成【确定】,填写完要添加的学生信息后,单击【确定】按钮可将学生信息添加到数据库中,最后该按钮上的文本变回【添加】
private void btnAdd_Click(object sender, EventArgs e)
{
try
{
if (btnAdd.Text.Trim() == "添加")
{
btnAdd.Text = "确定";
objOpen();
Clear();
btnUpadate.Enabled = false;
btnDelete.Enabled = false;
btnClose.Enabled = false;
dgrdvStudent.Enabled = false;
}
else
{
btnAdd.Text = "添加";
if (SNumber.Text.Trim() != null && SName.Text.Trim() != null)
{
string sqlStr;
sqlStr = "insert into tbl_Student values ('" + S Number.Text.Trim() + "','" + SName.Text.Trim() + "','" + SSex.Text.Trim() + "'," + SAge.Text.Trim() + ",'" + SYuanXi.Text.Trim() + "')";
DataBase db = new DataBase();
bool b;
b = db.UpdateDB(sqlStr);
if (b == true)
{
if (MessageBox.Show("添加成功!继续添加吗?", "添加", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Clear();
objOpen();
btnAdd.Text = "确定";
}
else
{
objClose();
btnClose.Enabled = true;
btnDelete.Enabled = true;
btnUpadate.Enabled = true;
dgrdvStudent.Enabled = true;
}
}
else
{
return;
}
}
else
{
MessageBox.Show("学号与姓名不能为空!");
SNumber.Focus();
btnAdd.Text = "确定";
}
RefreshData();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Clear();
objClose();
dgrdvStudent.Enabled = false;
}
}
//修改学生记录
private void btnUpadate_Click(object sender, EventArgs e)
{
try
{
if (btnUpadate.Text.Trim() == "修改")
{
btnUpadate.Text = "确定";
btnAdd.Enabled = false;
btnDelete.Enabled = false;
btnClose.Enabled = false;
SName.Enabled = true;
SAge.Enabled = true;
SSex.Enabled = true;
SYuanXi.Enabled = true;
SName.Focus();
}
else
{
btnUpadate.Text = "修改";
btnAdd.Enabled = true;
btnDelete.Enabled = true;
btnClose.Enabled = true;
objClose();
string sqlStr;
sqlStr = "Update tbl_Student set Sname='" + SName.Text.Trim() + "',Ssex='" + SSex.Text.Trim() + "',Sage='" + SAge.Text.Trim() + "',Sdept='" + SYuanXi.Text.Trim() + "' where Sno='" + SNumber.Text.Trim() + "'";
DataBase db = new DataBase();
db.UpdateDB(sqlStr);
RefreshData();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//删除学生记录
private void btnDelete_Click(object sender, EventArgs e)
{
try
{
if (SNumber.Text.Trim() != "")
{
if (MessageBox.Show("确定要删除学生吗?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string sqlStr;
sqlStr = "delete from tbl_Student where Sno='" + SNumber.Text.Trim() + "'";
DataBase db = new DataBase();
db.UpdateDB(sqlStr);
RefreshData();
}
}
else
{
MessageBox.Show("没有可删除的记录!", "提示");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//关闭系统
private void btnClose_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
课程信息管理代码实现:
namespace WindowsFormsApplication4
{
//textbox1=CourseNo
//textbox2=CourseName
//textbox3=CourseCredit
//textbox4=CoursePeriod
//combox=CourseSemester
//button1=btnAdd
//button2=btnUpdate
//button3=btnDelete
//button4=btnClose
public partial class frmCourse : Form
{
public frmCourse()
{
InitializeComponent();
}
void objOpen()
{
CourseNo.Enabled = true;
CourseName.Enabled = true;
CourseCredit.Enabled = true;
CourseSemester.Enabled = true;
CoursePeriod.Enabled = true;
CourseNo.Focus();
}
void objClose()
{
CourseNo.Enabled = false;
CourseName.Enabled = false;
CourseCredit.Enabled = false;
CourseSemester.Enabled = false;
CoursePeriod.Enabled = false;
}
void Clear()
{
CourseNo.Text = "";
CourseName.Text = "";
CourseCredit.Text = "";
CourseSemester.Text = "";
CoursePeriod.Text = "";
}
//添加每列的标题
void SetHeaderText()
{
dgrdvCouser.Columns[0].HeaderText = "课程编号";
dgrdvCouser.Columns[1].HeaderText = "课程名称";
dgrdvCouser.Columns[2].HeaderText = "课程学分";
dgrdvCouser.Columns[3].HeaderText = "开课学期";
dgrdvCouser.Columns[4].HeaderText = "总学时";
}
//更新数据
void RefreshData()
{
string comStr;
DataBase db = new DataBase();
DataSet ds = new DataSet();
comStr = "select * from tbl_Course";
ds = db.GetDataFormDB(comStr);
if (ds == null)
{
MessageBox.Show("无法找到该课程!");
}
else
{
dgrdvCouser.DataSource = ds.Tables[0];
SetHeaderText();
}
}
private void Form4_Load(object sender, EventArgs e)
{
objClose();
RefreshData();
}
//添加学期
private void btnAdd_Click(object sender, EventArgs e)
{
try
{
if (btnAdd.Text.Trim() == "添加")
{
btnAdd.Text = "确定";
objOpen();
Clear();
btnUpdate.Enabled = false;
btnDelete.Enabled = false;
btnClose.Enabled = false;
dgrdvCouser.Enabled = false;
}
else
{
btnAdd.Text = "添加";
if (CourseNo.Text.Trim() != null && CourseName.Text.Trim() != null)
{
string sqlStr;
sqlStr = "insert into tbl_Course values ('" + CourseNo.Text.Trim() + "','" + CourseName.Text.Trim() + "','" + CourseSemester.Text.Trim() + "','" + CourseCredit.Text.Trim() + "','" + CoursePeriod.Text.Trim() + "')";
DataBase db = new DataBase();
bool b;
b = db.UpdateDB(sqlStr);
if (b == true)
{
if (MessageBox.Show("添加成功!继续添加吗?", "添加", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Clear();
objOpen();
btnAdd.Text = "确定";
}
else
{
objClose();
btnClose.Enabled = true;
btnDelete.Enabled = true;
btnUpdate.Enabled = true;
dgrdvCouser.Enabled = true;
}
}
else
{
return;
}
}
else
{
MessageBox.Show("学号与姓名不能为空!");
CourseNo.Focus();
btnAdd.Text = "确定";
}
RefreshData();
CourseNo.SelectAll();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Clear();
objClose();
dgrdvCouser.Enabled = false;
}
}
private void btnUpdate_Click(object sender, EventArgs e)
{
try
{
if (btnUpdate.Text.Trim() == "修改")
{
btnUpdate.Text = "确定";
btnAdd.Enabled = false;
btnDelete.Enabled = false;
btnClose.Enabled = false;
CourseName.Enabled = true;
CourseCredit.Enabled = true;
CourseSemester.Enabled = true;
CoursePeriod.Enabled = true;
CourseName.Focus();
}
else
{
btnUpdate.Text = "修改";
btnAdd.Enabled = true;
btnDelete.Enabled = true;
btnClose.Enabled = true;
objClose();
string sqlStr;
sqlStr = "Update tbl_Course set Cname='" + CourseName.Text.Trim() + "',Csemester='" + CourseSemester.Text.Trim() + "',Ccredit='" + CourseCredit.Text.Trim() + "',Cperiod='" + CoursePeriod.Text.Trim() + "' where Cno='" + CourseNo.Text.Trim() + "'";
DataBase db = new DataBase();
db.UpdateDB(sqlStr);
RefreshData();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
try
{
if (CourseNo.Text.Trim() != "")
{
if (MessageBox.Show("确定要删除课程吗?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string sqlStr;
sqlStr = "delete from tbl_Course where Cno='" + CourseNo.Text.Trim() + "'";
DataBase db = new DataBase();
db.UpdateDB(sqlStr);
RefreshData();
}
}
else
{
MessageBox.Show("无可删除的记录!", "提示");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button4_Click(object sender, EventArgs e)
{
this.Hide();
}
private void dgrdvCouser_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
int n = this.dgrdvCouser.CurrentCell.RowIndex;
CourseNo.Text = this.dgrdvCouser[0, n].Value.ToString();
CourseName.Text = this.dgrdvCouser[1, n].Value.ToString();
CourseSemester.Text= this.dgrdvCouser[2, n].Value.ToString();
CourseCredit.Text = this.dgrdvCouser[3, n].Value.ToString();
CoursePeriod.Text = this.dgrdvCouser[4, n].Value.ToString();
}
}
}
成绩信息管理代码实现:
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication4
{
//comboBox1=SelStudent
//comboBox2=SelCourse
//conboBox3=Selcondition
//TextBox1=Grade
//TextBox2=txtSelText
//Button1=btnGradeIn
//Button2=btnSelect
//Button3=btnSelAll
//Button4=btnClose
public partial class frmSC : Form
{
string selectcondition;
public frmSC()
{
InitializeComponent();
}
//给每一列添加列名
void SetHeaderText()
{
dgrdvResult.Columns[0].HeaderText = "学号";
dgrdvResult.Columns[1].HeaderText = "姓名";
dgrdvResult.Columns[2].HeaderText = "课程号";
dgrdvResult.Columns[3].HeaderText = "课程名";
dgrdvResult.Columns[4].HeaderText = "成绩";
}
private void frmSC_Load(object sender, EventArgs e)
{
Selcondition.Items.Add("学生学号");
Selcondition.Items.Add("课程编号");
DataBase dbStudent = new DataBase();
DataSet dataSetStudent = new DataSet();
string sqlStr = "select Sno,Sname from tbl_Student";
dataSetStudent = dbStudent.GetDataFormDB(sqlStr);
if (dataSetStudent.Tables[0].Rows.Count > 0)
{
SelStudent.Items.Clear();
for (int i = 0; i < dataSetStudent.Tables[0].Rows.Count; i++)
{
SelStudent.Items.Add(dataSetStudent.Tables[0].Rows[i].ItemArray[0].ToString() + "--" + dataSetStudent.Tables[0].Rows[i].ItemArray[1].ToString());
}
}
DataBase dbCourse = new DataBase();
DataSet dataSetCourse = new DataSet();
sqlStr = "select Cno,Cname from tbl_Course";
dataSetCourse = dbCourse.GetDataFormDB(sqlStr);
if (dataSetCourse.Tables[0].Rows.Count > 0)
{
SelCourse.Items.Clear();
for (int i = 0; i < dataSetCourse.Tables[0].Rows.Count; i++)
{
SelCourse.Items.Add(dataSetCourse.Tables[0].Rows[i].ItemArray[0].ToString() + "--" + dataSetCourse.Tables[0].Rows[i].ItemArray[1].ToString());
}
}
}
//查询事件按键
private void btnSelect_Click(object sender, EventArgs e)
{
try
{
if (Selcondition.SelectedIndex == -1 || txtSelText.Text == "")
{
MessageBox.Show("请选择查询条件并输入查询值!");
}
else
{
string sqlStr = "SELECT tbl_SC.Sno,tbl_Student.Sname,tbl_SC.Cno,tbl_Course.Cname,tbl_SC.grade FROM tbl_Student,tbl_Course,tbl_SC where tbl_Course.Cno=tbl_SC.Cno and tbl_Student.Sno=tbl_SC.Sno and " + selectcondition + "='" + txtSelText.Text.Trim() + "'";
DataBase db = new DataBase();
DataSet dataSetSelect = new DataSet();
dataSetSelect = db.GetDataFormDB(sqlStr);
if (dataSetSelect.Tables[0].Rows.Count == 0)
{
MessageBox.Show("没有符合条件的成绩记录!");
}
else
{
dgrdvResult.DataSource = dataSetSelect.Tables[0];
SetHeaderText();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void cmbSelcondition_SelectedIndexChanged(object sender, EventArgs e)
{
switch (Selcondition.SelectedIndex)
{
case 0:
selectcondition = "tbl_SC.Sno";
break;
case 1:
selectcondition = "tbl_SC.Cno";
break;
}
}
//学生成绩录入
private void btnGradeIn_Click(object sender, EventArgs e)
{
if (SelStudent.SelectedIndex >= 0 && SelCourse.SelectedIndex >= 0)
{
string sqlStr = "insert into tbl_SC values('" +SelStudent.Text.Trim().Substring(0, 4) + "','" + SelCourse.Text.Trim().Substring(0, 4) + "'," + Grade.Text.Trim() + ")";
DataBase db = new DataBase();
bool b = db.UpdateDB(sqlStr);
if (b == true)
{
MessageBox.Show("成绩录入成功!", "学生成绩录入");
}
else
{
MessageBox.Show("该生成绩已录入!", "学生成绩录入", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("请先选择学生和课程!");
}
SelStudent.SelectedIndex = -1;
SelCourse.SelectedIndex = -1;
Grade.Text = "";
}
//显示全部选课信息
private void btnSelAll_Click(object sender, EventArgs e)
{
string sqlStr = "SELECT tbl_SC.Sno,tbl_Student.Sname,tbl_SC.Cno,tbl_Course.Cname,tbl_SC.grade FROM tbl_Student,tbl_Course,tbl_SC where tbl_Course.Cno = tbl_SC.Cno and tbl_Student.Sno = tbl_SC.Sno";
DataBase db = new DataBase();
DataSet dataSetSelect = new DataSet();
dataSetSelect = db.GetDataFormDB(sqlStr);
if (dataSetSelect == null)
{
MessageBox.Show("没有符合条件的成绩记录!");
}
else
{
dgrdvResult.DataSource = dataSetSelect.Tables[0];
SetHeaderText();
}
}
//退出系统
private void btnClose_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
最后
以上就是无奈衬衫为你收集整理的C#学生成绩系统窗体应用程序开发,用ADO.NET访问数据库相应组件,构建完成一套学生成绩系统。学生成绩系统是学校教务系统中不可缺少的一个子系统,它涉及到学生、课程等信息的结合。的全部内容,希望文章能够帮你解决C#学生成绩系统窗体应用程序开发,用ADO.NET访问数据库相应组件,构建完成一套学生成绩系统。学生成绩系统是学校教务系统中不可缺少的一个子系统,它涉及到学生、课程等信息的结合。所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复