C#综合应用实习——学生成绩管理系统(P.4学生成绩录入)

本文详细介绍了如何使用C#实现学生成绩管理系统的功能,包括专业、课程名列表加载,专业与学号联动,成绩显示与录入,以及成绩修改和删除。系统在启动时自动加载专业和课程列表,并在用户选择时实时更新学号和成绩信息。用户可以通过界面直接修改和录入成绩,操作完成后可选择保存或取消。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

功能要求:

界面设计:

 功能实现:

1.专业、课程名列表选项加载

2.专业和学号列表联动

3.显示某学生某一门课的成绩

4.学生成绩显示到表单

5.录入学生成绩


功能要求:

用户选择专业,系统列出专业所有学生的学号;选择课程名,在表格中显示此课程的成绩、学分。通过单击表格中的某一行,把某学生该门课的成绩反映到表单控件中,并可以修改表单中的信息。用户还可以添加新课程,录入新课程的成绩,并把当前录入的成绩添加到数据库中。选中某条记录的学号和课程名,单击“删除”按钮,可以删除该学生原课程的成绩。

界面设计:

学生成绩录入界面所需控件及属性所用和学生成绩修改类似。

其中三个组合框控件的DropDownStyle属性均设置为DropDownList。

学生成绩录入界面如下图:

 功能实现:

1.专业、课程名列表选项加载

为方便用户使用,程序启动时需要加载专业和课程名的列表。在窗体的Load事件中编写代码,代码如下:

public partial class ScoreForm : Form
    {

        private string connStr = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=XSCJDB;Integrated Security=True";
        public ScoreForm()
        {
            InitializeComponent();
        }

        private void ScoreForm_Load(object sender, EventArgs e)
        {
            string _sql = "SELECT distinct ZY FROM XSB";
            SqlConnection conn = new SqlConnection(connStr);
            SqlCommand cmd = new SqlCommand(_sql, conn);
            try
            {
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                //读取专业名
                while (dr.Read())
                {
                    stuZY.Items.Add(dr[0]);
                }
                stuZY.SelectedIndex = 0;
                dr.Close();
                _sql = "SELECT KCM FROM KCB";
                cmd = new SqlCommand(_sql, conn);
                dr = cmd.ExecuteReader();
                //读取课程名
                while (dr.Read())
                {
                    stuKCM.Items.Add(dr[0]);
                }
                dr.Close();
            }
            finally
            {
                conn.Close();
            }
        }
}
C#.net实现学生成绩管理系统 namespace 学生成绩管理系统 { partial class Formlogin { /// /// 必需的设计器变量。 /// private System.ComponentModel.IContainer components = null; /// /// 清理所有正在使用的资源。 /// /// 如果应释放托管资源,为 true;否则为 false。 protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// private void InitializeComponent() { this.labeluser = new System.Windows.Forms.Label(); this.textBoxuser = new System.Windows.Forms.TextBox(); this.labelcode = new System.Windows.Forms.Label(); this.textBoxcode = new System.Windows.Forms.TextBox(); this.buttonin = new System.Windows.Forms.Button(); this.buttonout = new System.Windows.Forms.Button(); this.SuspendLayout(); // // labeluser // this.labeluser.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.labeluser.Location = new System.Drawing.Point(31, 50); this.labeluser.Name = "labeluser"; this.labeluser.Size = new System.Drawing.Size(55, 26); this.labeluser.TabIndex = 0; this.labeluser.Text = "用户名"; this.labeluser.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // textBoxuser // this.textBoxuser.Location = new System.Drawing.Point(126, 55); this.textBoxuser.Name = "textBoxuser"; this.textBoxuser.Size = new System.Drawing.Size(112, 21); this.textBoxuser.TabIndex = 1; // // labelcode // this.labelcode.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.labelcode.Location = new System.Drawing.Point(31, 124); this.labelcode.Name = "labelcode"; this.labelcode.Size = new System.Drawing.Size(55, 23); this.labelcode.TabIndex = 2; this.labelcode.Text = "密码"; this.labelcode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // textBoxcode // this.textBoxcode.Location = new System.Drawing.Point(126, 124); this.textBoxcode.Name = "textBoxcode"; this.textBoxcode.PasswordChar = '*'; this.textBoxcode.Size = new System.Drawing.Size(112, 21); this.textBoxcode.TabIndex = 3; // // buttonin // this.buttonin.Location = new System.Drawing.Point(34, 200); this.buttonin.Name = "buttonin"; this.buttonin.Size = new System.Drawing.Size(75, 23); this.buttonin.TabIndex = 4; this.buttonin.Text = "登陆"; this.buttonin.UseVisualStyleBackColor = true; this.buttonin.Click += new System.EventHandler(this.buttonin_Click); // // buttonout // this.buttonout.Location = new System.Drawing.Point(163, 200); this.buttonout.Name = "buttonout"; this.buttonout.Size = new
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值