欧美free性护士vide0shd,老熟女,一区二区三区,久久久久夜夜夜精品国产,久久久久久综合网天天,欧美成人护士h版

首頁綜合 正文
目錄

柚子快報邀請碼778899分享:開發(fā)語言 c#學(xué)生管理系統(tǒng)

Etsy手工坊綜合2025-05-05430

柚子快報邀請碼778899分享:開發(fā)語言 c#學(xué)生管理系統(tǒng)

http://yzkb.51969.com/

一、系統(tǒng)概述

學(xué)生管理系統(tǒng)是一個旨在幫助學(xué)校、教育機(jī)構(gòu)和教育者有效管理學(xué)生信息、課程安排和成績記錄的應(yīng)用程序。該系統(tǒng)旨在簡化學(xué)生管理的各個方面,提供高效的解決方案,以滿足教育機(jī)構(gòu)的需求。

二、功能模塊

1. 學(xué)生信息管理

添加學(xué)生:錄入學(xué)生基本信息(姓名、性別、學(xué)號等)

編輯學(xué)生:修改已經(jīng)錄入的學(xué)生信息

刪除學(xué)生:通過學(xué)號刪除指定學(xué)生信息

全部學(xué)生查詢:查詢所有錄入學(xué)生信息

個別學(xué)生查詢:支持按學(xué)號或姓名進(jìn)行精確查詢

2.班級管理

查詢班級列表按條件查詢新增班級

3.年級

查詢所有年級

三、開發(fā)技術(shù)

前端:C# WinForm 后端:mysql IDE:Visual Studio

四、數(shù)據(jù)庫分析

1. ClassInfos(班級表)

ClassId:班級編號(主鍵)ClassName:班級名稱GradeId:年級編號(外鍵關(guān)聯(lián)GradeInfos表)Remark:備注

主要記錄每個年級下的各個班級名稱等信息。

2. GradeInfos(年級表)

GradeId:年級編號(主鍵)GradeName:年級名稱

記錄學(xué)校的各個年級名稱。

3. StudentInfos(學(xué)生表)

StuId:學(xué)生編號(主鍵)StuName:姓名ClassId:班級編號(外鍵關(guān)聯(lián)ClassInfos表)Sex:性別Phone:電話CreateTime:創(chuàng)建時間(默認(rèn)當(dāng)前時間)IsDeleted:邏輯刪除(默認(rèn)0,不刪除)

記錄每個學(xué)生的詳細(xì)信息。

4. UserInfos(用戶表)

UserId:用戶編號(主鍵)UserName:用戶名UserPwd:密碼

記錄應(yīng)用的管理用戶信息。

5. 總體關(guān)系:

班級表與年級表一對多,學(xué)生表與班級表一對多,表之間定義好外鍵關(guān)系。

基本上五張表記錄了學(xué)生管理系統(tǒng)需要跟蹤的所有實(shí)體信息,關(guān)系定義合理,能夠很好支持學(xué)生管理相關(guān)業(yè)務(wù)開發(fā)。

四、程序截圖

五、聯(lián)系與交流

q:969060742 文檔、代碼、sql、程序資源

六、部分代碼

FrmAddClass.cs

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WinStudent

{

public partial class FrmAddClass : Form

{

public FrmAddClass()

{

InitializeComponent();

}

///

/// 初始化年級列表

///

///

///

private void FrmAddClass_Load(object sender, EventArgs e)

{

InitGradeList();//加載年級列表

}

//一個班級,必須屬于某個年級

private void InitGradeList()

{

string sql = "select GradeId,GradeName from GradeInfos";

DataTable dtGradeList = SqlHelper.GetDataTable(sql);

cboGrades.DataSource = dtGradeList;

//年級名稱 ---- 項

cboGrades.DisplayMember = "GradeName";//顯示的內(nèi)容

cboGrades.ValueMember = "GradeId";//值

cboGrades.SelectedIndex = 0;

}

///

/// 添加班級

///

///

///

private void btnAdd_Click(object sender, EventArgs e)

{

//信息獲取

string className = txtClassName.Text.Trim();

int gradeId = (int)cboGrades.SelectedValue;

string remark = txtRemark.Text.Trim();

//判斷是否為空

if (string.IsNullOrEmpty(className))

{

MessageBox.Show("班級名稱不能為空!", "添加班級提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

//判斷是否已存在 數(shù)據(jù)庫里去檢查--- 與數(shù)據(jù)庫進(jìn)行交互

{

string sqlExists = "select count(1) from ClassInfos where ClassName=@ClassName and GradeId=@GradeId";

SqlParameter[] paras =

{

new SqlParameter("@ClassName",className),

new SqlParameter("@GradeId",gradeId)

};

object oCount = SqlHelper.ExecuteScalar(sqlExists, paras);

if (oCount == null || oCount == DBNull.Value || ((int)oCount) == 0)

{

//添加操作

string sqlAdd = "insert into ClassInfos (ClassName,GradeId,Remark) values (@ClassName,@GradeId,@Remark)";

SqlParameter[] parasAdd =

{

new SqlParameter("@ClassName",className),

new SqlParameter("@GradeId",gradeId),

new SqlParameter("@Remark",remark)

};

//執(zhí)行并返回值

int count = SqlHelper.ExecuteNonQuery(sqlAdd, parasAdd);

if(count>0)

{

MessageBox.Show($"班級:{className} 添加成功!", "添加班級提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

else

{

MessageBox.Show("班級添加失敗!", "添加班級提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

}

else

{

MessageBox.Show("班級名稱已存在!", "添加班級提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

}

}

private void btnClose_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

DrmAddClass.Designer.cs

namespace WinStudent

{

partial class FrmAddClass

{

///

/// Required designer variable.

///

private System.ComponentModel.IContainer components = null;

///

/// Clean up any resources being used.

///

/// true if managed resources should be disposed; otherwise, false.

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Windows Form Designer generated code

///

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

///

private void InitializeComponent()

{

this.panel1 = new System.Windows.Forms.Panel();

this.btnClose = new System.Windows.Forms.Button();

this.btnAdd = new System.Windows.Forms.Button();

this.txtRemark = new System.Windows.Forms.TextBox();

this.cboGrades = new System.Windows.Forms.ComboBox();

this.txtClassName = new System.Windows.Forms.TextBox();

this.label3 = new System.Windows.Forms.Label();

this.label2 = new System.Windows.Forms.Label();

this.label1 = new System.Windows.Forms.Label();

this.panel1.SuspendLayout();

this.SuspendLayout();

//

// panel1

//

this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

| System.Windows.Forms.AnchorStyles.Left)

| System.Windows.Forms.AnchorStyles.Right)));

this.panel1.AutoScroll = true;

this.panel1.Controls.Add(this.btnClose);

this.panel1.Controls.Add(this.btnAdd);

this.panel1.Controls.Add(this.txtRemark);

this.panel1.Controls.Add(this.cboGrades);

this.panel1.Controls.Add(this.txtClassName);

this.panel1.Controls.Add(this.label3);

this.panel1.Controls.Add(this.label2);

this.panel1.Controls.Add(this.label1);

this.panel1.Location = new System.Drawing.Point(25, 26);

this.panel1.Name = "panel1";

this.panel1.Size = new System.Drawing.Size(275, 257);

this.panel1.TabIndex = 0;

//

// btnClose

//

this.btnClose.Location = new System.Drawing.Point(162, 222);

this.btnClose.Name = "btnClose";

this.btnClose.Size = new System.Drawing.Size(75, 23);

this.btnClose.TabIndex = 7;

this.btnClose.Text = "關(guān)閉";

this.btnClose.UseVisualStyleBackColor = true;

this.btnClose.Click += new System.EventHandler(this.btnClose_Click);

//

// btnAdd

//

this.btnAdd.Location = new System.Drawing.Point(60, 222);

this.btnAdd.Name = "btnAdd";

this.btnAdd.Size = new System.Drawing.Size(75, 23);

this.btnAdd.TabIndex = 6;

this.btnAdd.Text = "添加";

this.btnAdd.UseVisualStyleBackColor = true;

this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);

//

// txtRemark

//

this.txtRemark.Location = new System.Drawing.Point(60, 96);

this.txtRemark.Multiline = true;

this.txtRemark.Name = "txtRemark";

this.txtRemark.Size = new System.Drawing.Size(212, 93);

this.txtRemark.TabIndex = 5;

//

// cboGrades

//

this.cboGrades.FormattingEnabled = true;

this.cboGrades.Location = new System.Drawing.Point(60, 47);

this.cboGrades.Name = "cboGrades";

this.cboGrades.Size = new System.Drawing.Size(138, 20);

this.cboGrades.TabIndex = 4;

//

// txtClassName

//

this.txtClassName.Location = new System.Drawing.Point(60, 9);

this.txtClassName.Name = "txtClassName";

this.txtClassName.Size = new System.Drawing.Size(212, 21);

this.txtClassName.TabIndex = 3;

//

// label3

//

this.label3.AutoSize = true;

this.label3.Location = new System.Drawing.Point(5, 99);

this.label3.Name = "label3";

this.label3.Size = new System.Drawing.Size(35, 12);

this.label3.TabIndex = 2;

this.label3.Text = "描述:";

//

// label2

//

this.label2.AutoSize = true;

this.label2.Location = new System.Drawing.Point(5, 50);

this.label2.Name = "label2";

this.label2.Size = new System.Drawing.Size(35, 12);

this.label2.TabIndex = 1;

this.label2.Text = "年級:";

//

// label1

//

this.label1.AutoSize = true;

this.label1.Location = new System.Drawing.Point(3, 12);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(35, 12);

this.label1.TabIndex = 0;

this.label1.Text = "班名:";

//

// FrmAddClass

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(326, 313);

this.Controls.Add(this.panel1);

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;

this.MaximizeBox = false;

this.Name = "FrmAddClass";

this.Text = "班級信息頁面";

this.Load += new System.EventHandler(this.FrmAddClass_Load);

this.panel1.ResumeLayout(false);

this.panel1.PerformLayout();

this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel panel1;

private System.Windows.Forms.TextBox txtRemark;

private System.Windows.Forms.ComboBox cboGrades;

private System.Windows.Forms.TextBox txtClassName;

private System.Windows.Forms.Label label3;

private System.Windows.Forms.Label label2;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.Button btnClose;

private System.Windows.Forms.Button btnAdd;

}

}

FrmAddStudent.cs

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WinStudent

{

public partial class FrmAddStudent : Form

{

public FrmAddStudent()

{

InitializeComponent();

}

private void btnAdd_Click(object sender, EventArgs e)

{

//1)獲取頁面信息輸入

string stuName = txtStuName.Text.Trim();

int classId = (int)cboClasses.SelectedValue;

string sex = rbtMale.Checked ? rbtMale.Text.Trim() : rbtFemale.Text.Trim();

string phone = txtPhone.Text.Trim();

//2)判空處理 姓名不可以為空 電話不可以為空

if (string.IsNullOrEmpty(stuName))

{

MessageBox.Show("姓名不能為空!", "添加學(xué)生提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

if (string.IsNullOrEmpty(phone))

{

MessageBox.Show("電話不能為空!", "添加學(xué)生提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

//3)判斷 姓名+電話 是否在數(shù)據(jù)庫里已存在 姓名+電話

string sql = "select count(1) from StudentInfos where StuName=@StuName and Phone=@phone";

SqlParameter[] paras =

{

new SqlParameter("@StuName",stuName),

new SqlParameter("@phone",phone)

};

object o = SqlHelper.ExecuteScalar(sql, paras);

if (o != null && o != DBNull.Value && ((int)o) > 0)

{

MessageBox.Show("該學(xué)生已存在!", "添加學(xué)生提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

//4)添加入庫 sql 參數(shù) 執(zhí)行 完成返回受影響行數(shù)

string sqlAdd = "insert into StudentInfos(StuName,ClassId,Sex,Phone) values(@StuName,@ClassId,@Sex,@Phone)";

SqlParameter[] parasAdd =

{

new SqlParameter("@StuName",stuName),

new SqlParameter("@ClassId",classId),

new SqlParameter("@Sex",sex),

new SqlParameter("@phone",phone)

};

int count = SqlHelper.ExecuteNonQuery(sqlAdd, parasAdd);

if(count>0)

{

MessageBox.Show($"學(xué)生:{stuName} 添加成功!", "添加學(xué)生提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

else

{

MessageBox.Show("該學(xué)生添加失敗,請檢查!", "添加學(xué)生提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

}

///

/// 加載班級列表\性別默認(rèn)選擇男

///

///

///

private void FrmAddStudent_Load(object sender, EventArgs e)

{

InitClasses();//加載班級列表

rbtMale.Checked = true;

}

private void InitClasses()

{

//獲取數(shù)據(jù) ---- 查詢 ---寫sql

string sql = "select ClassId,ClassName,GradeName from ClassInfos c,GradeInfos g where c.GradeId=g.GradeId";

DataTable dtClasses = SqlHelper.GetDataTable(sql);

//組合班級列表顯示項的過程

if (dtClasses.Rows.Count > 0)

{

foreach (DataRow dr in dtClasses.Rows)

{

string className = dr["ClassName"].ToString();

string gradeName = dr["GradeName"].ToString();

dr["ClassName"] = className + "--" + gradeName;

}

}

//指定數(shù)據(jù)源

cboClasses.DataSource = dtClasses;

cboClasses.DisplayMember = "ClassName";

cboClasses.ValueMember = "ClassId";

cboClasses.SelectedIndex = 0;

}

private void btnClose_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

FrmGradeList.cs

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;

namespace WinStudent

{

public partial class FrmGradeList : Form

{

public FrmGradeList()

{

InitializeComponent();

}

private void FrmGradeList_Load(object sender, EventArgs e)

{

string sql = "select GradeId,GradeName from GradeInfos";

DataTable dtGradeList = SqlHelper.GetDataTable(sql);

dgvGradeList.DataSource = dtGradeList;

}

}

}

FrmLogin.cs

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 WinStudent

{

public partial class FrmLogin : Form

{

public FrmLogin()

{

InitializeComponent();

}

///

/// 登錄系統(tǒng)

///

///

///

private void btnLogin_Click(object sender, EventArgs e)

{

//獲取用戶輸入信息

string uName = txtUserName.Text.Trim();

string uPwd = txtUserPwd.Text.Trim();

//判斷是否為空

if(string.IsNullOrEmpty(uName))

{

MessageBox.Show("請輸入賬號!", "登錄提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

txtUserName.Focus();

return;

}

if (string.IsNullOrEmpty(uPwd))

{

MessageBox.Show("請輸入密碼!", "登錄提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

txtUserPwd.Focus();

return;

}

//與數(shù)據(jù)庫通信 檢查輸入與數(shù)據(jù)庫中是否一致

{

//寫查詢語句 拼接式 Sql注入 推薦大家使用參數(shù)化Sql

string sql = "select count(1) from UserInfos where UserName=@UserName and UserPwd=@UserPwd";

SqlParameter[] paras =

{

new SqlParameter("@UserName", uName),

new SqlParameter("@UserPwd", uPwd)

};

建立與數(shù)據(jù)庫的連接

連接字符串 --- 鑰匙

string connString = "server=.;database=StudentDB;Integrated Security=true";//字符串 Windows身份驗證

//string connString = "server=.;database=StudentDB;uid=lyc;pwd=123456;";//Sql Server 身份驗證 Data Source Initial Catalog User Id Password

//SqlConnection conn = new SqlConnection(connString);

//添加參數(shù)

//SqlParameter paraUName = new SqlParameter("@UserName", uName);

//SqlParameter paraUPwd = new SqlParameter("@UserPwd", uPwd);

創(chuàng)建Command對象

//SqlCommand cmd = new SqlCommand(sql, conn);

cmd.CommandType = CommandType.StoredProcedure;//存儲過程

//cmd.Parameters.Clear();

cmd.Parameters.Add(paraUName);

cmd.Parameters.Add(paraUPwd);

//cmd.Parameters.AddRange(paras);

打開連接

//conn.Open(); //最晚打開 最早關(guān)閉

執(zhí)行命令 要求必須在連接狀態(tài) Opened

//object o = cmd.ExecuteScalar();//執(zhí)行查詢,返回結(jié)果集第一行第一列的值,忽略其他行或列

關(guān)閉連接

//conn.Close();

//調(diào)用

object o = SqlHelper.ExecuteScalar(sql, paras);

//處理結(jié)果

if (o==null||o==DBNull.Value ||((int)o)==0)

{

MessageBox.Show("登錄賬號或密碼有錯,請檢查!", "登錄提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

return;

}

else

{

MessageBox.Show("登錄成功!", "登錄提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

//轉(zhuǎn)到主頁面

FrmMain fMain = new FrmMain();

fMain.Show();

this.Hide();

}

}

}

private void btnExit_Click(object sender, EventArgs e)

{

this.Close();

// Application.Exit();

}

}

}

柚子快報邀請碼778899分享:開發(fā)語言 c#學(xué)生管理系統(tǒng)

http://yzkb.51969.com/

相關(guān)文章

評論可見,查看隱藏內(nèi)容

本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點(diǎn)和立場。

轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。

本文鏈接:http://gantiao.com.cn/post/17835173.html

發(fā)布評論

您暫未設(shè)置收款碼

請在主題配置——文章設(shè)置里上傳

掃描二維碼手機(jī)訪問

文章目錄