├── 数据库设计.txt ├── 数据库原理课程实验 2020 内容与要求.pdf ├── StudentManager ├── StudentManager │ ├── obj │ │ └── Debug │ │ │ ├── StudentManager.csproj.CoreCompileInputs.cache │ │ │ ├── StudentManager.exe │ │ │ ├── StudentManager.pdb │ │ │ ├── StudentManager.Form1.resources │ │ │ ├── StudentManager.Form2.resources │ │ │ ├── StudentManager.Form3.resources │ │ │ ├── StudentManager.countForm.resources │ │ │ ├── StudentManager.loginForm.resources │ │ │ ├── StudentManager.MillonTest.resources │ │ │ ├── StudentManager.addmanForm.resources │ │ │ ├── StudentManager.addstuForm.resources │ │ │ ├── StudentManager.chooseForm.resources │ │ │ ├── StudentManager.kaisheForm.resources │ │ │ ├── StudentManager.modifymanForm.resources │ │ │ ├── StudentManager.modifymimaForm.resources │ │ │ ├── StudentManager.modifystuForm.resources │ │ │ ├── StudentManager.showkebiaoForm.resources │ │ │ ├── DesignTimeResolveAssemblyReferences.cache │ │ │ ├── StudentManager.modifygradeFram.resources │ │ │ ├── StudentManager.searchclassForm.resources │ │ │ ├── StudentManager.searchgradeForm.resources │ │ │ ├── StudentManager.csproj.GenerateResource.cache │ │ │ ├── StudentManager.csprojAssemblyReference.cache │ │ │ ├── TempPE │ │ │ └── Properties.Resources.Designer.cs.dll │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ │ ├── StudentManager.Properties.Resources.resources │ │ │ └── .NETFramework,Version=v4.7.2.AssemblyAttributes.cs │ ├── Resources │ │ └── 1.jpg │ ├── bin │ │ └── Debug │ │ │ ├── StudentManager.exe │ │ │ ├── StudentManager.pdb │ │ │ └── StudentManager.exe.config │ ├── App.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── AssemblyInfo.cs │ │ ├── Settings.Designer.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── ModifyTeacherInfo.cs │ ├── About.cs │ ├── Program.cs │ ├── AddTeacher.cs │ ├── SearchGradeForm.cs │ ├── ShowCurriculum.cs │ ├── About.Designer.cs │ ├── ModifyPassword.cs │ ├── AddAdmin.cs │ ├── StudentForm.cs │ ├── AddStudent.cs │ ├── ModifyStudentGrade.cs │ ├── ModifyAdminInfo.cs │ ├── CourseInformation.cs │ ├── SearchClassForm.cs │ ├── ShowCurriculum.Designer.cs │ ├── GradeShowForm.cs │ ├── loginForm.cs │ ├── AddGradeForm.cs │ ├── StudentForm.Designer.cs │ ├── About.resx │ ├── AddAdmin.resx │ ├── AddGradeForm.resx │ ├── AddStudent.resx │ ├── AddTeacher.resx │ ├── MillonTest.resx │ ├── StudentForm.resx │ ├── loginForm.resx │ ├── CourseInformation.resx │ ├── GradeShowForm.resx │ ├── ModifyAdminInfo.resx │ ├── ModifyPassword.resx │ ├── ModifyStudentInfo.resx │ ├── ModifyTeacherInfo.resx │ ├── SearchClassForm.resx │ ├── SearchGradeForm.resx │ ├── SelectClassForm.resx │ ├── ShowCurriculum.resx │ ├── ModifyStudentGrade.resx │ ├── SearchGradeForm.Designer.cs │ ├── Form1.cs │ ├── MillonTest.Designer.cs │ └── ModifyStudentInfo.cs ├── .vs │ └── StudentManager │ │ └── v16 │ │ ├── .suo │ │ └── Browse.VC.db └── StudentManager.sln └── README.md /数据库设计.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/数据库设计.txt -------------------------------------------------------------------------------- /数据库原理课程实验 2020 内容与要求.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/数据库原理课程实验 2020 内容与要求.pdf -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 05447f8b4d7728c0483cb9e116ce89c6310eec38 2 | -------------------------------------------------------------------------------- /StudentManager/.vs/StudentManager/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/.vs/StudentManager/v16/.suo -------------------------------------------------------------------------------- /StudentManager/StudentManager/Resources/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/Resources/1.jpg -------------------------------------------------------------------------------- /StudentManager/.vs/StudentManager/v16/Browse.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/.vs/StudentManager/v16/Browse.VC.db -------------------------------------------------------------------------------- /StudentManager/StudentManager/bin/Debug/StudentManager.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/bin/Debug/StudentManager.exe -------------------------------------------------------------------------------- /StudentManager/StudentManager/bin/Debug/StudentManager.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/bin/Debug/StudentManager.pdb -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.exe -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.pdb -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.Form1.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.Form2.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.Form2.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.Form3.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.Form3.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.countForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.countForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.loginForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.loginForm.resources -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DateBaseExperiment 2 | 南京航空航天大学数据库实验相关资料,学生教务管理系统,C# + sqlServer实现 3 | 4 | 运行环境为win10 64位 5 | 6 | 编译器为VS2019 7 | 8 | 数据库为sqlServer 9 | 10 | 代码供大家学习参考,编程能力有限,不排除个别地方存在错误,希望能帮到各位. 11 | 12 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.MillonTest.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.MillonTest.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.addmanForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.addmanForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.addstuForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.addstuForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.chooseForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.chooseForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.kaisheForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.kaisheForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.modifymanForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.modifymanForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.modifymimaForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.modifymimaForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.modifystuForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.modifystuForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.showkebiaoForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.showkebiaoForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.modifygradeFram.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.modifygradeFram.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.searchclassForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.searchclassForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.searchgradeForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.searchgradeForm.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/StudentManager.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoubs/DateBaseExperiment/HEAD/StudentManager/StudentManager/obj/Debug/StudentManager.Properties.Resources.resources -------------------------------------------------------------------------------- /StudentManager/StudentManager/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/bin/Debug/StudentManager.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] 5 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyTeacherInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace StudentManager 11 | { 12 | public partial class modifyteacForm : Form 13 | { 14 | public modifyteacForm() 15 | { 16 | InitializeComponent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/About.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class aboutForm : Form 14 | { 15 | public aboutForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace StudentManager 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// 应用程序的主入口点。 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | Application.Run(new loginForm()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddTeacher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace StudentManager 11 | { 12 | public partial class addteacForm : Form 13 | { 14 | public addteacForm() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void button2_Click(object sender, EventArgs e) 20 | { 21 | this.Close(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("StudentManager")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("StudentManager")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("47c00c6a-e391-4bf7-b677-b66e1049a4c8")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /StudentManager/StudentManager.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentManager", "StudentManager\StudentManager.csproj", "{47C00C6A-E391-4BF7-B677-B66E1049A4C8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {47C00C6A-E391-4BF7-B677-B66E1049A4C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {47C00C6A-E391-4BF7-B677-B66E1049A4C8}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {47C00C6A-E391-4BF7-B677-B66E1049A4C8}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {47C00C6A-E391-4BF7-B677-B66E1049A4C8}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {B5EBBDCE-9B84-4E83-AEF5-153277AA73A1} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace StudentManager.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/SearchGradeForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class searchgradeForm : Form 14 | { 15 | public searchgradeForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void label1_Click(object sender, EventArgs e) 21 | { 22 | 23 | } 24 | 25 | private void button1_Click(object sender, EventArgs e) 26 | { 27 | string term = comboBox1.SelectedItem.ToString(); 28 | //首先得到用户的id 29 | string stuxuehao = loginForm.getStudent(); 30 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 31 | conn.Open(); 32 | string sql = "select Sid from Student where Sno = '" + stuxuehao + "'"; 33 | SqlCommand cmd = new SqlCommand(sql, conn); 34 | String id1 = cmd.ExecuteScalar().ToString(); 35 | int stuid = 0; 36 | int.TryParse(id1, out stuid); 37 | //用到两个数据库的连接操作 38 | sql = "select Class.Cname as 课程名称,Class.Cterm as 学期,SC.Grade as 成绩 from SC,Class where Class.Cid=SC.Cid and SC.Sid=" + stuid; 39 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 40 | DataSet ds = new DataSet(); 41 | adp1.Fill(ds); 42 | //载入基本信息 43 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 44 | conn.Close(); 45 | 46 | 47 | 48 | 49 | } 50 | 51 | private void groupbox5_Enter(object sender, EventArgs e) 52 | { 53 | 54 | } 55 | 56 | private void searchgradeForm_Load(object sender, EventArgs e) 57 | { 58 | 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ShowCurriculum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | namespace StudentManager 11 | { 12 | public partial class showkebiaoForm : Form 13 | { 14 | public showkebiaoForm() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void showkebiaoForm_Load(object sender, EventArgs e) 20 | { 21 | //首先得到用户的id 22 | string stuxuehao = loginForm.getStudent(); 23 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 24 | conn.Open(); 25 | string sql = "select Sid from Student where Sno = '" + stuxuehao + "'"; 26 | SqlCommand cmd = new SqlCommand(sql, conn); 27 | String id1 = cmd.ExecuteScalar().ToString(); 28 | int stuid = 0; 29 | int.TryParse(id1, out stuid); 30 | //用到两个数据库的连接操作 31 | 32 | sql = "select Class.Cid as 课程id,Class.Cname as 课程名称,Class.Cteacher as 教师姓名,Class.Cterm as 学期,Ctime.Ctime as 上课时间,Ctime.Classroom as 上课地点 from SC,Ctime,Class where Class.Cid=SC.Cid and SC.Cid=Ctime.Cid and SC.Sid=" + stuid; 33 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 34 | DataSet ds = new DataSet(); 35 | adp1.Fill(ds); 36 | //载入基本信息 37 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 38 | conn.Close(); 39 | } 40 | 41 | private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e) 42 | { 43 | 44 | } 45 | 46 | private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) 47 | { 48 | 49 | } 50 | 51 | private void button1_Click(object sender, EventArgs e) 52 | { 53 | 54 | } 55 | 56 | private void groupBox1_Enter(object sender, EventArgs e) 57 | { 58 | 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/About.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace StudentManager 2 | { 3 | partial class aboutForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.panel1 = new System.Windows.Forms.Panel(); 32 | this.SuspendLayout(); 33 | // 34 | // panel1 35 | // 36 | this.panel1.BackgroundImage = global::StudentManager.Properties.Resources._1; 37 | this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 38 | this.panel1.Location = new System.Drawing.Point(6, -2); 39 | this.panel1.Margin = new System.Windows.Forms.Padding(4); 40 | this.panel1.Name = "panel1"; 41 | this.panel1.Size = new System.Drawing.Size(1048, 609); 42 | this.panel1.TabIndex = 0; 43 | // 44 | // aboutForm 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(1058, 605); 49 | this.Controls.Add(this.panel1); 50 | this.Margin = new System.Windows.Forms.Padding(4); 51 | this.Name = "aboutForm"; 52 | this.Text = "关于"; 53 | this.ResumeLayout(false); 54 | 55 | } 56 | 57 | #endregion 58 | 59 | private System.Windows.Forms.Panel panel1; 60 | } 61 | } -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyPassword.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class modifymimaForm : Form 14 | { 15 | public modifymimaForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void modifymimaForm_Load(object sender, EventArgs e) 21 | { 22 | textBox1.Text = loginForm.getStudent(); 23 | 24 | } 25 | 26 | private void button1_Click(object sender, EventArgs e) 27 | { 28 | string passwd = textBox2.Text; 29 | string quepasswd = textBox3.Text; 30 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 31 | conn.Open(); 32 | if (passwd == "" || quepasswd == "") 33 | { 34 | MessageBox.Show("请将信息填写完整!"); 35 | } 36 | else 37 | { 38 | if (quepasswd != passwd) 39 | { 40 | MessageBox.Show("两次输入的密码不一致!"); 41 | } 42 | else 43 | { 44 | 45 | if (loginForm.getRole() == "学生") 46 | { 47 | SqlCommand cmd = new SqlCommand(); 48 | cmd.Connection = conn; 49 | string sql = "update Student set Spassword ='" + passwd + "' where Sno = '" + textBox1.Text + "'"; 50 | cmd.CommandText = sql; 51 | cmd.ExecuteNonQuery(); 52 | MessageBox.Show("修改密码成功!"); 53 | 54 | } 55 | else 56 | { 57 | SqlCommand cmd = new SqlCommand(); 58 | cmd.Connection = conn; 59 | string sql = "update Manager set Mpassword ='" + passwd + "' where Mname = '" + textBox1.Text + "'"; 60 | cmd.CommandText = sql; 61 | cmd.ExecuteNonQuery(); 62 | MessageBox.Show("修改密码成功!"); 63 | 64 | } 65 | 66 | 67 | } 68 | conn.Close(); 69 | } 70 | 71 | } 72 | 73 | private void button2_Click(object sender, EventArgs e) 74 | { 75 | this.Close(); 76 | } 77 | 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddAdmin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class addmanForm : Form 14 | { 15 | public addmanForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void button1_Click(object sender, EventArgs e) 21 | { 22 | if (textBox1.Text.Trim() == "" || textBox2.Text.Trim() == "") 23 | { 24 | MessageBox.Show("请将信息填写完整!"); 25 | } 26 | else 27 | { 28 | if (textBox2.Text.Trim() != textBox3.Text.Trim()) 29 | { 30 | MessageBox.Show("两次输入的密码不一致!"); 31 | } 32 | else 33 | { 34 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 35 | conn.Open(); 36 | string sql = "select * from Manager where Mname = '" + textBox1.Text + "'"; 37 | SqlDataAdapter adp = new SqlDataAdapter(sql, conn); 38 | DataSet ds = new DataSet(); 39 | adp.Fill(ds); 40 | if (ds.Tables[0].Rows.Count > 0) 41 | { 42 | MessageBox.Show("已经存在的用户名称!"); 43 | } 44 | else 45 | { 46 | SqlCommand cmd = new SqlCommand(); 47 | cmd.Connection = conn; 48 | sql = "insert into Manager (Mname,Mpassword) values ('" 49 | + textBox1.Text.Trim() + "','" + textBox2.Text.Trim() + "')"; 50 | cmd.CommandText = sql; 51 | cmd.ExecuteNonQuery(); 52 | MessageBox.Show("添加用户成功!"); 53 | } 54 | textBox1.Text = ""; 55 | textBox2.Text = ""; 56 | textBox3.Text = ""; 57 | conn.Close(); 58 | } 59 | 60 | } 61 | 62 | 63 | } 64 | 65 | private void groupBox1_Enter(object sender, EventArgs e) 66 | { 67 | 68 | } 69 | 70 | private void button2_Click(object sender, EventArgs e) 71 | { 72 | this.Close(); 73 | } 74 | 75 | private void textBox1_TextChanged(object sender, EventArgs e) 76 | { 77 | 78 | } 79 | 80 | private void addmanForm_Load(object sender, EventArgs e) 81 | { 82 | 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/StudentForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace StudentManager 11 | { 12 | public partial class Form3 : Form 13 | { 14 | public Form3() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) 20 | { 21 | switch (this.treeView1.SelectedNode.Text) 22 | { 23 | 24 | case "我的成绩单": 25 | searchgradeForm f1 = new searchgradeForm(); 26 | f1.TopLevel = false; 27 | f1.FormBorderStyle = FormBorderStyle.None; 28 | f1.WindowState = FormWindowState.Maximized; 29 | 30 | panel1.Controls.Add(f1); 31 | f1.Show(); 32 | break; 33 | 34 | 35 | case "选择课程": 36 | chooseForm f4 = new chooseForm(); 37 | f4.TopLevel = false; 38 | f4.FormBorderStyle = FormBorderStyle.None; 39 | f4.WindowState = FormWindowState.Maximized; 40 | 41 | panel1.Controls.Add(f4); 42 | f4.Show(); 43 | break; 44 | case "查询课程": 45 | searchclassForm f5 = new searchclassForm(); 46 | f5.TopLevel = false; 47 | f5.FormBorderStyle = FormBorderStyle.None; 48 | f5.WindowState = FormWindowState.Maximized; 49 | 50 | panel1.Controls.Add(f5); 51 | f5.Show(); 52 | break; 53 | 54 | case "退出系统": 55 | Application.Exit(); 56 | break; 57 | case "显示课表": 58 | showkebiaoForm f13 = new showkebiaoForm(); 59 | f13.TopLevel = false; 60 | f13.FormBorderStyle = FormBorderStyle.None; 61 | f13.WindowState = FormWindowState.Maximized; 62 | panel1.Controls.Add(f13); 63 | f13.Show(); 64 | break; 65 | 66 | case "修改密码": 67 | modifymimaForm f14 = new modifymimaForm(); 68 | f14.TopLevel = false; 69 | f14.FormBorderStyle = FormBorderStyle.None; 70 | f14.WindowState = FormWindowState.Maximized; 71 | panel1.Controls.Add(f14); 72 | f14.Show(); 73 | break; 74 | } 75 | } 76 | 77 | private void Form3_FormClosed(object sender, FormClosedEventArgs e) 78 | { 79 | Application.Exit(); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace StudentManager.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StudentManager.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 重写当前线程的 CurrentUICulture 属性 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 65 | /// 66 | internal static System.Drawing.Bitmap _1 { 67 | get { 68 | object obj = ResourceManager.GetObject("1", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddStudent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class addstuForm : Form 14 | { 15 | public addstuForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void button1_Click(object sender, EventArgs e) 21 | { 22 | if (textBoxname.Text == "" || textBoxpname.Text == "" || textBoxpasswd.Text == "" || textBoxhometown.Text == "" || textBoxpname.Text == "" || textBoxpasswd.Text == "" || comboBoxgrade.SelectedItem == null || comboBoxmajor.SelectedItem == null || (!radioButton1.Checked && !radioButton2.Checked) || dateTimePicker1.Value == null) 23 | { 24 | MessageBox.Show("请将信息输入完整!"); 25 | } 26 | else 27 | { 28 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 29 | conn.Open(); 30 | string sql = "select * from Student where Sno='" + textBoxpname.Text.Trim() + "'"; 31 | SqlDataAdapter adp = new SqlDataAdapter(sql, conn); 32 | DataSet ds = new DataSet(); 33 | adp.Fill(ds); 34 | if (ds.Tables[0].Rows.Count > 0) 35 | { 36 | MessageBox.Show("已经存在的学生学号!"); 37 | } 38 | 39 | else 40 | { 41 | SqlCommand cmd = new SqlCommand(); 42 | cmd.Connection = conn; 43 | string gender = radioButton1.Checked ? "男" : "女"; 44 | sql = "insert into Student(Sname,Sno ,Spassword,Sgrade ,Smajor,Ssex,Sbirth,Shometown)values('" + textBoxname.Text.Trim() + "','" + textBoxpname.Text.Trim() + "','" + textBoxpasswd.Text.Trim() + "','" + comboBoxgrade.SelectedItem.ToString() + "','" + comboBoxmajor.SelectedItem.ToString() + "','" + gender + "','" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + textBoxhometown.Text.Trim() + "')"; 45 | cmd.CommandText = sql; 46 | cmd.ExecuteNonQuery(); 47 | MessageBox.Show("添加用户成功!"); 48 | } 49 | textBoxname.Text = ""; 50 | textBoxpname.Text = ""; 51 | textBoxpasswd.Text = ""; 52 | textBoxhometown.Text = ""; 53 | conn.Close(); 54 | } 55 | } 56 | 57 | private void button2_Click(object sender, EventArgs e) 58 | { 59 | this.Close(); 60 | } 61 | 62 | private void radioButton1_CheckedChanged(object sender, EventArgs e) 63 | { 64 | 65 | } 66 | 67 | private void groupBox1_Enter(object sender, EventArgs e) 68 | { 69 | 70 | } 71 | 72 | private void comboBoxgrade_SelectedIndexChanged(object sender, EventArgs e) 73 | { 74 | 75 | } 76 | 77 | private void textBoxname_TextChanged(object sender, EventArgs e) 78 | { 79 | 80 | } 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyStudentGrade.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class modifygradeFram : Form 14 | { 15 | public modifygradeFram() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void button1_Click(object sender, EventArgs e) 21 | { 22 | while (dataGridView1.Rows.Count != 0) 23 | { 24 | dataGridView1.DataSource = null; 25 | } 26 | 27 | if (comboBoxterm.Text == "" || textBoxclass.Text == "") 28 | { 29 | MessageBox.Show("请输入查询信息!"); 30 | } 31 | else if (comboBoxterm.Text != "" && textBoxclass.Text != "") 32 | { 33 | 34 | Console.WriteLine("学期" + comboBoxterm.SelectedItem.ToString()); 35 | Console.WriteLine("课程" + textBoxclass.Text); 36 | 37 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 38 | conn.Open(); 39 | string sql = "select Student.Sno as 学生学号,Student.Sname as 学生姓名,SC.Grade as 成绩,Class.Cname as 课程名,Class.Cterm as 学期,Class.Cteacher as 老师 from Class,Student,SC where Student.Sid=SC.Sid and SC.Cid=Class.Cid and Class.Cterm = '" + comboBoxterm.SelectedItem.ToString() + "'and Class.Cname='" + textBoxclass.Text + "'"; 40 | Console.WriteLine(sql); 41 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 42 | DataSet ds = new DataSet(); 43 | adp1.Fill(ds); 44 | //载入基本信息 45 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 46 | conn.Close(); 47 | } 48 | } 49 | 50 | private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) 51 | { 52 | textBoxteacher.Text = dataGridView1.SelectedRows[0].Cells[5].Value.ToString(); 53 | textBoxgrade.Text = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); 54 | textBoxkecheng.Text = dataGridView1.SelectedRows[0].Cells[3].Value.ToString(); 55 | textBoxxuehao.Text = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); 56 | } 57 | 58 | private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) 59 | { 60 | 61 | } 62 | 63 | private void button3_Click(object sender, EventArgs e) 64 | { 65 | //根据学生的学号得到学生的id 66 | string stuxuehao = textBoxxuehao.Text; 67 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 68 | conn.Open(); 69 | string sql = "select Sid from Student where Sno = '" + stuxuehao + "'"; 70 | SqlCommand cmd = new SqlCommand(sql, conn); 71 | String id1 = cmd.ExecuteScalar().ToString(); 72 | int stuid = 0; 73 | int.TryParse(id1, out stuid); 74 | sql = "update SC set Grade = " + textBoxgrade.Text + "where Sid=" + stuid; 75 | cmd.CommandText = sql; 76 | if (cmd.ExecuteNonQuery() > 0) 77 | { 78 | MessageBox.Show("更改成功!"); 79 | } 80 | conn.Close(); 81 | } 82 | 83 | private void button2_Click(object sender, EventArgs e) 84 | { 85 | this.Close(); 86 | } 87 | 88 | private void modifygradeFram_Load(object sender, EventArgs e) 89 | { 90 | 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyAdminInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | namespace StudentManager 11 | { 12 | public partial class modifymanForm : Form 13 | { 14 | public modifymanForm() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void groupBox1_Enter(object sender, EventArgs e) 20 | { 21 | 22 | } 23 | 24 | private void textBox1_TextChanged(object sender, EventArgs e) 25 | { 26 | 27 | } 28 | 29 | private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) 30 | { 31 | 32 | } 33 | 34 | private void modifymanForm_Load(object sender, EventArgs e) 35 | { 36 | this.getRusult(); 37 | } 38 | 39 | private void mos_click(object sender, DataGridViewCellMouseEventArgs e) 40 | { 41 | if (dataGridView1.SelectedCells.Count != 0) 42 | { 43 | textBox3.Text = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); 44 | textBox1.Text = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); 45 | textBox2.Text = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); 46 | } 47 | 48 | } 49 | 50 | private void getRusult() 51 | { 52 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 53 | conn.Open(); 54 | //textBox1.Text.Trim() textBox2.Text.Trim() 55 | string sql = "select Mid as 用户id, Mname as 用户名,Mpassword as 密码 from Manager"; 56 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 57 | DataSet ds = new DataSet(); 58 | adp1.Fill(ds); 59 | //载入基本信息 60 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 61 | conn.Close(); 62 | } 63 | 64 | 65 | private void button1_Click(object sender, EventArgs e) 66 | { 67 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 68 | conn.Open(); 69 | int id = 0; 70 | int.TryParse(textBox3.Text, out id); 71 | string sql = "update Manager set Mname = '" + textBox1.Text + "',Mpassword = '" + textBox2.Text + "' where Mid = " + id; 72 | SqlCommand cmd = new SqlCommand(sql, conn); 73 | if (cmd.ExecuteNonQuery() > 0) 74 | { 75 | this.getRusult(); 76 | MessageBox.Show("更改成功!"); 77 | } 78 | conn.Close(); 79 | } 80 | 81 | private void button2_Click(object sender, EventArgs e) 82 | { 83 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 84 | conn.Open(); 85 | int id = 0; 86 | int.TryParse(textBox3.Text, out id); 87 | string sql = "delete from Manager where Mid = " + id; 88 | SqlCommand cmd = new SqlCommand(sql, conn); 89 | if (cmd.ExecuteNonQuery() > 0) 90 | { 91 | this.getRusult(); 92 | MessageBox.Show("删除成功!"); 93 | } 94 | 95 | conn.Close(); 96 | } 97 | 98 | private void textBox3_TextChanged(object sender, EventArgs e) 99 | { 100 | 101 | } 102 | 103 | private void groupBox2_Enter(object sender, EventArgs e) 104 | { 105 | 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/CourseInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | namespace StudentManager 11 | { 12 | public partial class kaisheForm : Form 13 | { 14 | public kaisheForm() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void groupBox1_Enter(object sender, EventArgs e) 20 | { 21 | 22 | } 23 | 24 | private void button1_Click(object sender, EventArgs e) 25 | { 26 | string teacher = textBoxteacher.Text; 27 | string classes = textBoxclass.Text; 28 | string term = comboBoxterm.SelectedItem.ToString(); 29 | string flags = "1"; 30 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 31 | conn.Open(); 32 | SqlCommand cmd = new SqlCommand(); 33 | cmd.Connection = conn; 34 | //将开课信息插入到开课表里 35 | 36 | //MessageBox.Show("开设课程成功!"); 37 | string sql = ""; 38 | //得到上课的地点 39 | string didian = comboBoxdidian.SelectedItem.ToString(); 40 | //checkedListBoxtime 41 | 42 | for (int i = 0; i < checkedListBoxtime.Items.Count; i++) 43 | { 44 | if (checkedListBoxtime.GetItemChecked(i)) 45 | { 46 | string time = checkedListBoxtime.GetItemText(checkedListBoxtime.Items[i]); 47 | sql = "select * from Ctime where Ctime = '" + time + "'and Classroom = '" + didian + "'"; 48 | SqlDataAdapter adp = new SqlDataAdapter(sql, conn); 49 | DataSet ds = new DataSet(); 50 | adp.Fill(ds); 51 | if (ds.Tables[0].Rows.Count > 0) 52 | { 53 | flags = "2"; 54 | MessageBox.Show("该时间该教室已经有课!"); 55 | break; 56 | } 57 | else 58 | { 59 | flags = "1"; 60 | break; 61 | } 62 | } 63 | } 64 | 65 | if (flags == "1") 66 | { 67 | sql = "insert into Class (Cname,Cterm,Cteacher) values ('" + classes + "','" + term + "','" + teacher + "')"; 68 | cmd.CommandText = sql; 69 | cmd.ExecuteNonQuery(); 70 | 71 | 72 | 73 | for (int i = 0; i < checkedListBoxtime.Items.Count; i++) 74 | { 75 | if (checkedListBoxtime.GetItemChecked(i)) 76 | { 77 | string time = checkedListBoxtime.GetItemText(checkedListBoxtime.Items[i]); 78 | //将开课表的id得到 79 | sql = "select Cid from Class where Cname = '" + classes + "' and Cterm = '" + term + "' and Cteacher = '" + teacher + "'"; 80 | cmd.CommandText = sql; 81 | String id1 = cmd.ExecuteScalar().ToString(); 82 | int id = 0; 83 | int.TryParse(id1, out id); 84 | sql = "insert into Ctime values(" + id + ",'" + time + "','" + didian + "')"; 85 | cmd.CommandText = sql; 86 | cmd.ExecuteNonQuery(); 87 | } 88 | } 89 | MessageBox.Show("开设课程成功!"); 90 | } 91 | 92 | conn.Close(); 93 | } 94 | 95 | private void kaisheForm_Load(object sender, EventArgs e) 96 | { 97 | 98 | } 99 | 100 | private void button2_Click(object sender, EventArgs e) 101 | { 102 | this.Close(); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/SearchClassForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class searchclassForm : Form 14 | { 15 | public searchclassForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void button1_Click(object sender, EventArgs e) 21 | { 22 | while (dataGridView1.Rows.Count != 0) 23 | { 24 | dataGridView1.DataSource = null; 25 | } 26 | if (comboBoxterm.Text == "" && textBoxclass.Text == "") 27 | { 28 | MessageBox.Show("请输入查询信息!"); 29 | } 30 | else if (comboBoxterm.Text != "" && textBoxclass.Text == "") 31 | { 32 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 33 | conn.Open(); 34 | string sql = "select Cid as 课程id,Cname as 课程名,Cterm as 学期,Cteacher as 老师 from Class where Cterm = '" + comboBoxterm.SelectedItem.ToString() + "'"; 35 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 36 | DataSet ds = new DataSet(); 37 | adp1.Fill(ds); 38 | //载入基本信息 39 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 40 | conn.Close(); 41 | } 42 | else if (textBoxclass.Text != "" && comboBoxterm.Text == "") 43 | { 44 | 45 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 46 | conn.Open(); 47 | //textBox1.Text.Trim() textBox2.Text.Trim() 48 | string sql = "select Cid as 课程id,Cname as 课程名,Cterm as 学期,Cteacher as 老师 from Class where Cname = '" + textBoxclass.Text + "'"; 49 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 50 | DataSet ds = new DataSet(); 51 | adp1.Fill(ds); 52 | //载入基本信息 53 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 54 | conn.Close(); 55 | 56 | 57 | } 58 | else if (textBoxclass.Text != "" && comboBoxterm.Text != "") 59 | { 60 | 61 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 62 | conn.Open(); 63 | //textBox1.Text.Trim() textBox2.Text.Trim() 64 | string sql = "select Cid as 课程id,Cname as 课程名,Cterm as 学期,Cteacher as 老师 from Class where Cname = '" + textBoxclass.Text + "'and Cterm ='" + comboBoxterm.SelectedItem.ToString() + "'"; 65 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 66 | DataSet ds = new DataSet(); 67 | adp1.Fill(ds); 68 | //载入基本信息 69 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 70 | conn.Close(); 71 | 72 | } 73 | 74 | 75 | 76 | } 77 | 78 | private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) 79 | { 80 | if (dataGridView1.SelectedCells.Count != 0) 81 | { 82 | string claid = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); 83 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 84 | conn.Open(); 85 | //textBox1.Text.Trim() textBox2.Text.Trim() 86 | string sql = "select Ctime as 上课时间,Classroom as 上课地点 from Ctime where Cid=" + claid; 87 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 88 | DataSet ds = new DataSet(); 89 | adp1.Fill(ds); 90 | //载入基本信息 91 | dataGridView2.DataSource = ds.Tables[0].DefaultView; 92 | conn.Close(); 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ShowCurriculum.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace StudentManager 2 | { 3 | partial class showkebiaoForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.dataGridView1 = new System.Windows.Forms.DataGridView(); 32 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 33 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); 34 | this.groupBox1.SuspendLayout(); 35 | this.SuspendLayout(); 36 | // 37 | // dataGridView1 38 | // 39 | this.dataGridView1.AllowUserToAddRows = false; 40 | this.dataGridView1.AllowUserToDeleteRows = false; 41 | this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 42 | this.dataGridView1.Location = new System.Drawing.Point(22, 51); 43 | this.dataGridView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 44 | this.dataGridView1.Name = "dataGridView1"; 45 | this.dataGridView1.RowHeadersWidth = 62; 46 | this.dataGridView1.RowTemplate.Height = 23; 47 | this.dataGridView1.Size = new System.Drawing.Size(1029, 460); 48 | this.dataGridView1.TabIndex = 0; 49 | this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); 50 | // 51 | // groupBox1 52 | // 53 | this.groupBox1.Controls.Add(this.dataGridView1); 54 | this.groupBox1.Location = new System.Drawing.Point(18, 18); 55 | this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 56 | this.groupBox1.Name = "groupBox1"; 57 | this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); 58 | this.groupBox1.Size = new System.Drawing.Size(1080, 556); 59 | this.groupBox1.TabIndex = 1; 60 | this.groupBox1.TabStop = false; 61 | this.groupBox1.Text = "我的课表"; 62 | this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter); 63 | // 64 | // showkebiaoForm 65 | // 66 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); 67 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 68 | this.BackColor = System.Drawing.SystemColors.ButtonFace; 69 | this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; 70 | this.ClientSize = new System.Drawing.Size(1116, 616); 71 | this.Controls.Add(this.groupBox1); 72 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 73 | this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 74 | this.Name = "showkebiaoForm"; 75 | this.Text = "课表"; 76 | this.Load += new System.EventHandler(this.showkebiaoForm_Load); 77 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); 78 | this.groupBox1.ResumeLayout(false); 79 | this.ResumeLayout(false); 80 | 81 | } 82 | 83 | #endregion 84 | 85 | private System.Windows.Forms.DataGridView dataGridView1; 86 | private System.Windows.Forms.GroupBox groupBox1; 87 | 88 | } 89 | } -------------------------------------------------------------------------------- /StudentManager/StudentManager/GradeShowForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class countForm : Form 14 | { 15 | public countForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void groupBox1_Enter(object sender, EventArgs e) 21 | { 22 | 23 | } 24 | 25 | private void button1_Click(object sender, EventArgs e) 26 | { 27 | string term = comboBox1.SelectedItem.ToString(); 28 | string claname = textBoxclass.Text; 29 | string g1 = textBox1.Text; 30 | int grade1 = 0; 31 | int.TryParse(g1, out grade1); 32 | string g2 = textBox2.Text; 33 | int grade2 = 0; 34 | int.TryParse(g2, out grade2); 35 | if (term == "" || claname == "") 36 | { 37 | MessageBox.Show("请将信息输入完整!"); 38 | } 39 | else 40 | { 41 | 42 | 43 | if (g1 == "" || g2 == "") 44 | { 45 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 46 | conn.Open(); 47 | //textBox1.Text.Trim() textBox2.Text.Trim() 48 | string sql = "select Class.Cname as 课程名称,Student.Sno as 学生学号,Sname as 学生姓名,SC.Grade as 成绩,Class.Cterm as 开课学期,Class.Cteacher as 开课教师 from Student,SC,Class where Student.Sid = SC.Sid and SC.Cid = Class.Cid and Cterm = '" + term + "' and Class.Cname = '" + claname + "'"; 49 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 50 | DataSet ds = new DataSet(); 51 | adp1.Fill(ds); 52 | //载入基本信息 53 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 54 | //求的平均成绩并显示 55 | sql = "select avg(Grade) from SC,Class where SC.Cid = Class.Cid and Class.Cname ='" + claname + "'"; 56 | SqlCommand cmd = new SqlCommand(); 57 | cmd.Connection = conn; 58 | cmd.CommandText = sql; 59 | String avg = cmd.ExecuteScalar().ToString(); 60 | textBoxav.Text = avg; 61 | //求的最高成绩并显示 62 | sql = "select max(Grade) from SC,Class where SC.Cid = Class.Cid and Class.Cname ='" + claname + "'"; 63 | 64 | cmd.CommandText = sql; 65 | String max = cmd.ExecuteScalar().ToString(); 66 | textBoxmax.Text = max; 67 | //求的最低成绩并显示 68 | sql = "select min(Grade) from SC,Class where SC.Cid = Class.Cid and Class.Cname ='" + claname + "'"; 69 | cmd.CommandText = sql; 70 | String min = cmd.ExecuteScalar().ToString(); 71 | textBoxmin.Text = min; 72 | conn.Close(); 73 | } 74 | else 75 | { 76 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 77 | conn.Open(); 78 | //textBox1.Text.Trim() textBox2.Text.Trim() 79 | string sql = "select Class.Cname as 课程名称,Sno as 学生学号,Student.Sname as 学生姓名,SC.Grade as 成绩,Class.Cterm as 开课学期,Class.Cteacher as 开课教师 from Student,SC,Class where Student.Sid = SC.Sid and SC.Cid = Class.Cid and Cterm = '" + term + "' and Class.Cname = '" + claname + "'and Grade between " + grade1 + " and " + grade2; 80 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 81 | DataSet ds = new DataSet(); 82 | adp1.Fill(ds); 83 | //载入基本信息 84 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 85 | conn.Close(); 86 | } 87 | 88 | 89 | } 90 | 91 | 92 | 93 | } 94 | 95 | private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) 96 | { 97 | 98 | } 99 | 100 | private void countForm_Load(object sender, EventArgs e) 101 | { 102 | 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/loginForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | namespace StudentManager 11 | { 12 | public partial class loginForm : Form 13 | { 14 | public static string connectionString = "uid=sa;pwd=123456;database=student;server=DESKTOP-Q7H2RSA"; 15 | public static string name; 16 | public static string role; 17 | 18 | public loginForm() 19 | { 20 | 21 | 22 | InitializeComponent(); 23 | 24 | } 25 | 26 | private void button1_Click(object sender, EventArgs e) 27 | { 28 | name = textBoxname.Text.Trim(); 29 | 30 | if (name == "" || textBoxpasswd.Text.Trim() == "" || this.comboBoxrole.SelectedItem == null) 31 | { 32 | MessageBox.Show("请将信息输入完整!"); 33 | } 34 | else 35 | { 36 | role = this.comboBoxrole.SelectedItem.ToString(); 37 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 38 | conn.Open(); 39 | if (role == "管理员") 40 | { 41 | string sql = "select Mname,Mpassword from Manager where role='管理员'and Mname='" + name + 42 | "' and Mpassword='" + textBoxpasswd.Text.Trim() + "'"; 43 | SqlDataAdapter adp = new SqlDataAdapter(sql, conn); 44 | DataSet ds = new DataSet(); 45 | adp.Fill(ds); 46 | if (ds.Tables[0].Rows.Count > 0) 47 | { 48 | conn.Close(); 49 | Form1 mainframe = new Form1(); 50 | mainframe.BringToFront(); 51 | mainframe.Show(); 52 | this.Hide(); 53 | 54 | } 55 | else 56 | { 57 | MessageBox.Show("用户名或者密码错误!"); 58 | } 59 | } 60 | else if (role == "学生") 61 | { 62 | string sql1 = "select Sno,Spassword from Student where role='学生'and Sno='" + name + 63 | "' and Spassword='" + textBoxpasswd.Text.Trim() + "'"; 64 | SqlDataAdapter adp = new SqlDataAdapter(sql1, conn); 65 | DataSet ds = new DataSet(); 66 | adp.Fill(ds); 67 | if (ds.Tables[0].Rows.Count > 0) 68 | { 69 | //this.Close(); 70 | conn.Close(); 71 | Form3 mainframe = new Form3(); 72 | mainframe.BringToFront(); 73 | mainframe.Show(); 74 | this.Hide(); 75 | } 76 | else 77 | { 78 | MessageBox.Show("用户名或者密码错误!"); 79 | } 80 | } 81 | 82 | } 83 | 84 | 85 | 86 | } 87 | 88 | 89 | 90 | 91 | 92 | 93 | private void textBox1_TextChanged(object sender, EventArgs e) 94 | { 95 | 96 | } 97 | 98 | private void button2_Click(object sender, EventArgs e) 99 | { 100 | Application.Exit(); 101 | } 102 | 103 | 104 | private void loginForm_Load(object sender, EventArgs e) 105 | { 106 | 107 | 108 | } 109 | 110 | private void comboBoxrole_SelectedIndexChanged(object sender, EventArgs e) 111 | { 112 | 113 | } 114 | 115 | public static String getStudent() 116 | { 117 | String stuxuehao = ""; 118 | stuxuehao = loginForm.name; 119 | return stuxuehao; 120 | } 121 | 122 | public static String getRole() 123 | { 124 | String role1 = ""; 125 | role1 = role; 126 | return role1; 127 | } 128 | 129 | private void button2_Click_1(object sender, EventArgs e) 130 | { 131 | this.Close(); 132 | } 133 | 134 | private void groupBox1_Enter(object sender, EventArgs e) 135 | { 136 | 137 | } 138 | 139 | private void buttontest_Click(object sender, EventArgs e) 140 | { 141 | MillonTest test = new MillonTest(); 142 | //test.TopLevel = false; 143 | //test.FormBorderStyle = FormBorderStyle.None; 144 | test.WindowState = FormWindowState.Normal; 145 | test.Show(); 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddGradeForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class Form2 : Form 14 | { 15 | public Form2() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void Form2_Load(object sender, EventArgs e) 21 | { 22 | 23 | 24 | } 25 | 26 | private void panelclass_Paint(object sender, PaintEventArgs e) 27 | { 28 | 29 | } 30 | 31 | private void groupBox2_Enter(object sender, EventArgs e) 32 | { 33 | 34 | } 35 | 36 | private void groupBox4_Enter(object sender, EventArgs e) 37 | { 38 | 39 | } 40 | 41 | private void listBox2_SelectedIndexChanged(object sender, EventArgs e) 42 | { 43 | textBoxstudent.Text = listBox2.SelectedItem.ToString(); 44 | } 45 | 46 | private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) 47 | { 48 | if (listBox1.Items.Count > 0) 49 | {//清空所有项 50 | listBox1.Items.Clear(); 51 | } 52 | if (textBoxclass.Text != "" || textBoxstudent.Text != "") 53 | { 54 | textBoxclass.Text = ""; 55 | textBoxstudent.Text = ""; 56 | } 57 | string term = comboBox1.SelectedItem.ToString(); 58 | Console.WriteLine(term); 59 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 60 | conn.Open(); 61 | string sql = "select Cname from Class where Cterm='" + term + "'"; 62 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 63 | DataSet ds = new DataSet(); 64 | adp1.Fill(ds); 65 | //载入基本信息 66 | foreach (DataRow row in ds.Tables[0].Rows) 67 | { 68 | listBox1.Items.Add(row[0].ToString()); 69 | } 70 | //dataGridView1.DataSource = ds.Tables[0].DefaultView; 71 | conn.Close(); 72 | } 73 | private void class_click(object sender, EventArgs e) 74 | { 75 | if (listBox2.Items.Count > 0) 76 | {//清空所有项 77 | listBox2.Items.Clear(); 78 | } 79 | textBoxstudent.Text = ""; 80 | string classname = listBox1.SelectedItem.ToString(); 81 | textBoxclass.Text = classname; 82 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 83 | conn.Open(); 84 | string sql = "select Student.Sno from Student,Class,SC where Student.Sid=SC.Sid and Class.Cid=SC.Cid and Class.Cname='" + classname + "'"; 85 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 86 | DataSet ds = new DataSet(); 87 | adp1.Fill(ds); 88 | foreach (DataRow row in ds.Tables[0].Rows) 89 | { 90 | listBox2.Items.Add(row[0].ToString()); 91 | } 92 | conn.Close(); 93 | } 94 | 95 | private void button1_Click(object sender, EventArgs e) 96 | { 97 | //根据学生的学号得到学生的id 98 | string stuxuehao = textBoxstudent.Text; 99 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 100 | conn.Open(); 101 | string sql = "select Sid from Student where Sno = '" + stuxuehao + "'"; 102 | SqlCommand cmd = new SqlCommand(sql, conn); 103 | String id1 = cmd.ExecuteScalar().ToString(); 104 | int stuid = 0; 105 | int.TryParse(id1, out stuid); 106 | //根据课程名得到课程的id 107 | string claname = textBoxclass.Text; 108 | sql = "select Cid from Class where Cname='" + claname + "'"; 109 | cmd.CommandText = sql; 110 | String id2 = cmd.ExecuteScalar().ToString(); 111 | int claid = 0; 112 | int.TryParse(id2, out claid); 113 | //得到相应的学生id,课程id,以及输入的成绩,将他们更新到sc表中,即更新成绩 114 | int grade = 0; 115 | int.TryParse(textBoxgrade.Text, out grade); 116 | //开始插入选课信息表中 117 | sql = "update SC set Grade = " + grade + " where Cid = " + claid + " and Sid = " + stuid; 118 | cmd.CommandText = sql; 119 | if (cmd.ExecuteNonQuery() > 0) 120 | { 121 | MessageBox.Show("输入成绩成功!"); 122 | textBoxgrade.Text = ""; 123 | textBoxclass.Text = ""; 124 | textBoxstudent.Text = ""; 125 | } 126 | conn.Close(); 127 | 128 | 129 | 130 | 131 | } 132 | 133 | private void textBoxstudent_TextChanged(object sender, EventArgs e) 134 | { 135 | 136 | } 137 | 138 | private void button2_Click(object sender, EventArgs e) 139 | { 140 | this.Close(); 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/StudentForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace StudentManager 2 | { 3 | partial class Form3 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("退出系统"); 32 | System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("系统管理", new System.Windows.Forms.TreeNode[] { 33 | treeNode1}); 34 | System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("选择课程"); 35 | System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("查询课程"); 36 | System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("显示课表"); 37 | System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("课程管理", new System.Windows.Forms.TreeNode[] { 38 | treeNode3, 39 | treeNode4, 40 | treeNode5}); 41 | System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("我的成绩单"); 42 | System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("成绩管理", new System.Windows.Forms.TreeNode[] { 43 | treeNode7}); 44 | System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("修改密码"); 45 | System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("关于"); 46 | this.treeView1 = new System.Windows.Forms.TreeView(); 47 | this.panel1 = new System.Windows.Forms.Panel(); 48 | this.SuspendLayout(); 49 | // 50 | // treeView1 51 | // 52 | this.treeView1.BackColor = System.Drawing.SystemColors.InactiveCaption; 53 | this.treeView1.Location = new System.Drawing.Point(20, 20); 54 | this.treeView1.Margin = new System.Windows.Forms.Padding(4); 55 | this.treeView1.Name = "treeView1"; 56 | treeNode1.Name = "节点1"; 57 | treeNode1.Text = "退出系统"; 58 | treeNode2.Name = "节点0"; 59 | treeNode2.Text = "系统管理"; 60 | treeNode3.Name = "节点3"; 61 | treeNode3.Text = "选择课程"; 62 | treeNode4.Name = "节点4"; 63 | treeNode4.Text = "查询课程"; 64 | treeNode5.Name = "节点5"; 65 | treeNode5.Text = "显示课表"; 66 | treeNode6.Name = "节点2"; 67 | treeNode6.Text = "课程管理"; 68 | treeNode7.Name = "节点7"; 69 | treeNode7.Text = "我的成绩单"; 70 | treeNode8.Name = "节点6"; 71 | treeNode8.Text = "成绩管理"; 72 | treeNode9.Name = "节点8"; 73 | treeNode9.Text = "修改密码"; 74 | treeNode10.Name = "节点9"; 75 | treeNode10.Text = "关于"; 76 | this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { 77 | treeNode2, 78 | treeNode6, 79 | treeNode8, 80 | treeNode9, 81 | treeNode10}); 82 | this.treeView1.Size = new System.Drawing.Size(256, 703); 83 | this.treeView1.TabIndex = 0; 84 | this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect); 85 | // 86 | // panel1 87 | // 88 | this.panel1.BackgroundImage = global::StudentManager.Properties.Resources._1; 89 | this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 90 | this.panel1.Location = new System.Drawing.Point(306, 18); 91 | this.panel1.Margin = new System.Windows.Forms.Padding(4); 92 | this.panel1.Name = "panel1"; 93 | this.panel1.Size = new System.Drawing.Size(1126, 704); 94 | this.panel1.TabIndex = 1; 95 | // 96 | // Form3 97 | // 98 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); 99 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 100 | this.ClientSize = new System.Drawing.Size(1452, 750); 101 | this.Controls.Add(this.panel1); 102 | this.Controls.Add(this.treeView1); 103 | this.Margin = new System.Windows.Forms.Padding(4); 104 | this.Name = "Form3"; 105 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 106 | this.Text = "学生端"; 107 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form3_FormClosed); 108 | this.ResumeLayout(false); 109 | 110 | } 111 | 112 | #endregion 113 | 114 | private System.Windows.Forms.TreeView treeView1; 115 | private System.Windows.Forms.Panel panel1; 116 | } 117 | } -------------------------------------------------------------------------------- /StudentManager/StudentManager/About.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddAdmin.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddGradeForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddStudent.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/AddTeacher.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/MillonTest.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/StudentForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/loginForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/CourseInformation.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/GradeShowForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyAdminInfo.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyPassword.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyStudentInfo.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyTeacherInfo.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/SearchClassForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/SearchGradeForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/SelectClassForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ShowCurriculum.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyStudentGrade.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/SearchGradeForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace StudentManager 2 | { 3 | partial class searchgradeForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.groupbox5 = new System.Windows.Forms.GroupBox(); 32 | this.dataGridView1 = new System.Windows.Forms.DataGridView(); 33 | this.button1 = new System.Windows.Forms.Button(); 34 | this.label1 = new System.Windows.Forms.Label(); 35 | this.comboBox1 = new System.Windows.Forms.ComboBox(); 36 | this.groupbox5.SuspendLayout(); 37 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // groupbox5 41 | // 42 | this.groupbox5.Controls.Add(this.dataGridView1); 43 | this.groupbox5.Controls.Add(this.button1); 44 | this.groupbox5.Controls.Add(this.label1); 45 | this.groupbox5.Controls.Add(this.comboBox1); 46 | this.groupbox5.Location = new System.Drawing.Point(15, 18); 47 | this.groupbox5.Margin = new System.Windows.Forms.Padding(4); 48 | this.groupbox5.Name = "groupbox5"; 49 | this.groupbox5.Padding = new System.Windows.Forms.Padding(4); 50 | this.groupbox5.Size = new System.Drawing.Size(1044, 690); 51 | this.groupbox5.TabIndex = 8; 52 | this.groupbox5.TabStop = false; 53 | this.groupbox5.Text = "我的成绩单"; 54 | this.groupbox5.Enter += new System.EventHandler(this.groupbox5_Enter); 55 | // 56 | // dataGridView1 57 | // 58 | this.dataGridView1.AllowUserToAddRows = false; 59 | this.dataGridView1.AllowUserToDeleteRows = false; 60 | this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 61 | this.dataGridView1.Location = new System.Drawing.Point(36, 129); 62 | this.dataGridView1.Margin = new System.Windows.Forms.Padding(4); 63 | this.dataGridView1.Name = "dataGridView1"; 64 | this.dataGridView1.RowHeadersWidth = 62; 65 | this.dataGridView1.RowTemplate.Height = 23; 66 | this.dataGridView1.Size = new System.Drawing.Size(978, 534); 67 | this.dataGridView1.TabIndex = 4; 68 | // 69 | // button1 70 | // 71 | this.button1.Location = new System.Drawing.Point(633, 58); 72 | this.button1.Margin = new System.Windows.Forms.Padding(4); 73 | this.button1.Name = "button1"; 74 | this.button1.Size = new System.Drawing.Size(112, 34); 75 | this.button1.TabIndex = 3; 76 | this.button1.Text = "查询"; 77 | this.button1.UseVisualStyleBackColor = true; 78 | this.button1.Click += new System.EventHandler(this.button1_Click); 79 | // 80 | // label1 81 | // 82 | this.label1.AutoSize = true; 83 | this.label1.Location = new System.Drawing.Point(243, 66); 84 | this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 85 | this.label1.Name = "label1"; 86 | this.label1.Size = new System.Drawing.Size(44, 18); 87 | this.label1.TabIndex = 2; 88 | this.label1.Text = "学期"; 89 | // 90 | // comboBox1 91 | // 92 | this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 93 | this.comboBox1.FormattingEnabled = true; 94 | this.comboBox1.Items.AddRange(new object[] { 95 | "2019年春季学期", 96 | "2019年秋季学期", 97 | "2020年春季学期", 98 | "2020年秋季学期"}); 99 | this.comboBox1.Location = new System.Drawing.Point(327, 62); 100 | this.comboBox1.Margin = new System.Windows.Forms.Padding(4); 101 | this.comboBox1.Name = "comboBox1"; 102 | this.comboBox1.Size = new System.Drawing.Size(266, 26); 103 | this.comboBox1.TabIndex = 0; 104 | // 105 | // searchgradeForm 106 | // 107 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); 108 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 109 | this.ClientSize = new System.Drawing.Size(1077, 758); 110 | this.Controls.Add(this.groupbox5); 111 | this.Margin = new System.Windows.Forms.Padding(4); 112 | this.Name = "searchgradeForm"; 113 | this.Text = "个人成绩"; 114 | this.Load += new System.EventHandler(this.searchgradeForm_Load); 115 | this.groupbox5.ResumeLayout(false); 116 | this.groupbox5.PerformLayout(); 117 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); 118 | this.ResumeLayout(false); 119 | 120 | } 121 | 122 | #endregion 123 | 124 | private System.Windows.Forms.GroupBox groupbox5; 125 | private System.Windows.Forms.Button button1; 126 | private System.Windows.Forms.Label label1; 127 | private System.Windows.Forms.ComboBox comboBox1; 128 | private System.Windows.Forms.DataGridView dataGridView1; 129 | } 130 | } -------------------------------------------------------------------------------- /StudentManager/StudentManager/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace StudentManager 11 | { 12 | public partial class Form1 : Form 13 | { 14 | public Form1() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) 20 | { 21 | switch (this.treeView1.SelectedNode.Text) 22 | { 23 | case "录入成绩": 24 | Form2 f = new Form2(); 25 | f.TopLevel = false; 26 | f.FormBorderStyle = FormBorderStyle.None; 27 | f.WindowState = FormWindowState.Maximized; 28 | panel2.Controls.Add(f); 29 | f.Show(); 30 | break; 31 | case "我的成绩单": 32 | searchgradeForm f1 = new searchgradeForm(); 33 | f1.TopLevel = false; 34 | f1.FormBorderStyle = FormBorderStyle.None; 35 | f1.WindowState = FormWindowState.Maximized; 36 | 37 | panel2.Controls.Add(f1); 38 | f1.Show(); 39 | break; 40 | case "统计成绩": 41 | countForm f2 = new countForm(); 42 | f2.TopLevel = false; 43 | f2.FormBorderStyle = FormBorderStyle.None; 44 | f2.WindowState = FormWindowState.Maximized; 45 | 46 | panel2.Controls.Add(f2); 47 | f2.Show(); 48 | break; 49 | case "开设课程": 50 | kaisheForm f3 = new kaisheForm(); 51 | f3.TopLevel = false; 52 | f3.FormBorderStyle = FormBorderStyle.None; 53 | f3.WindowState = FormWindowState.Maximized; 54 | 55 | panel2.Controls.Add(f3); 56 | f3.Show(); 57 | break; 58 | case "选择课程": 59 | chooseForm f4 = new chooseForm(); 60 | f4.TopLevel = false; 61 | f4.FormBorderStyle = FormBorderStyle.None; 62 | f4.WindowState = FormWindowState.Maximized; 63 | 64 | panel2.Controls.Add(f4); 65 | f4.Show(); 66 | break; 67 | case "查询课程": 68 | searchclassForm f5 = new searchclassForm(); 69 | f5.TopLevel = false; 70 | f5.FormBorderStyle = FormBorderStyle.None; 71 | f5.WindowState = FormWindowState.Maximized; 72 | 73 | panel2.Controls.Add(f5); 74 | f5.Show(); 75 | break; 76 | case "添加管理员信息": 77 | addmanForm f6 = new addmanForm(); 78 | f6.TopLevel = false; 79 | f6.FormBorderStyle = FormBorderStyle.None; 80 | f6.WindowState = FormWindowState.Maximized; 81 | 82 | panel2.Controls.Add(f6); 83 | f6.Show(); 84 | break; 85 | case "修改管理员信息": 86 | modifymanForm f7 = new modifymanForm(); 87 | f7.TopLevel = false; 88 | f7.FormBorderStyle = FormBorderStyle.None; 89 | f7.WindowState = FormWindowState.Maximized; 90 | 91 | panel2.Controls.Add(f7); 92 | f7.Show(); 93 | break; 94 | case "添加学生信息": 95 | addstuForm f10 = new addstuForm(); 96 | f10.TopLevel = false; 97 | f10.FormBorderStyle = FormBorderStyle.None; 98 | f10.WindowState = FormWindowState.Maximized; 99 | 100 | panel2.Controls.Add(f10); 101 | f10.Show(); 102 | break; 103 | case "修改学生信息": 104 | modifystuForm f11 = new modifystuForm(); 105 | f11.TopLevel = false; 106 | f11.FormBorderStyle = FormBorderStyle.None; 107 | f11.WindowState = FormWindowState.Maximized; 108 | 109 | panel2.Controls.Add(f11); 110 | f11.Show(); 111 | break; 112 | 113 | case "退出系统": 114 | Application.Exit(); 115 | break; 116 | case "显示课表": 117 | showkebiaoForm f13 = new showkebiaoForm(); 118 | f13.TopLevel = false; 119 | f13.FormBorderStyle = FormBorderStyle.None; 120 | f13.WindowState = FormWindowState.Maximized; 121 | panel2.Controls.Add(f13); 122 | f13.Show(); 123 | break; 124 | 125 | case "修改密码": 126 | modifymimaForm f14 = new modifymimaForm(); 127 | f14.TopLevel = false; 128 | f14.FormBorderStyle = FormBorderStyle.None; 129 | f14.WindowState = FormWindowState.Maximized; 130 | panel2.Controls.Add(f14); 131 | f14.Show(); 132 | break; 133 | case "修改成绩": 134 | modifygradeFram f15 = new modifygradeFram(); 135 | f15.TopLevel = false; 136 | f15.FormBorderStyle = FormBorderStyle.None; 137 | f15.WindowState = FormWindowState.Maximized; 138 | panel2.Controls.Add(f15); 139 | f15.Show(); 140 | break; 141 | } 142 | } 143 | 144 | private void Form1_Load(object sender, EventArgs e) 145 | { 146 | //loginForm login = new loginForm(); 147 | //login.ShowDialog(); 148 | } 149 | 150 | private void panel2_Paint(object sender, PaintEventArgs e) 151 | { 152 | 153 | } 154 | 155 | private void form_close(object sender, FormClosedEventArgs e) 156 | { 157 | Application.Exit(); 158 | } 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | -------------------------------------------------------------------------------- /StudentManager/StudentManager/MillonTest.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace StudentManager 2 | { 3 | partial class MillonTest 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.buttoninsert = new System.Windows.Forms.Button(); 32 | this.buttondelete = new System.Windows.Forms.Button(); 33 | this.textBoxSno = new System.Windows.Forms.TextBox(); 34 | this.textBoxTime = new System.Windows.Forms.TextBox(); 35 | this.label1 = new System.Windows.Forms.Label(); 36 | this.label2 = new System.Windows.Forms.Label(); 37 | this.buttonselect = new System.Windows.Forms.Button(); 38 | this.panel1 = new System.Windows.Forms.Panel(); 39 | this.panel1.SuspendLayout(); 40 | this.SuspendLayout(); 41 | // 42 | // buttoninsert 43 | // 44 | this.buttoninsert.Enabled = false; 45 | this.buttoninsert.Location = new System.Drawing.Point(81, 33); 46 | this.buttoninsert.Name = "buttoninsert"; 47 | this.buttoninsert.Size = new System.Drawing.Size(100, 37); 48 | this.buttoninsert.TabIndex = 6; 49 | this.buttoninsert.Text = "导入"; 50 | this.buttoninsert.UseVisualStyleBackColor = true; 51 | this.buttoninsert.Click += new System.EventHandler(this.buttoninsert_Click); 52 | // 53 | // buttondelete 54 | // 55 | this.buttondelete.Location = new System.Drawing.Point(528, 190); 56 | this.buttondelete.Name = "buttondelete"; 57 | this.buttondelete.Size = new System.Drawing.Size(100, 42); 58 | this.buttondelete.TabIndex = 0; 59 | this.buttondelete.Text = "删除"; 60 | this.buttondelete.UseVisualStyleBackColor = true; 61 | this.buttondelete.Click += new System.EventHandler(this.buttondelete_Click); 62 | // 63 | // textBoxSno 64 | // 65 | this.textBoxSno.Location = new System.Drawing.Point(148, 101); 66 | this.textBoxSno.Name = "textBoxSno"; 67 | this.textBoxSno.Size = new System.Drawing.Size(213, 28); 68 | this.textBoxSno.TabIndex = 1; 69 | // 70 | // textBoxTime 71 | // 72 | this.textBoxTime.Location = new System.Drawing.Point(481, 101); 73 | this.textBoxTime.Name = "textBoxTime"; 74 | this.textBoxTime.Size = new System.Drawing.Size(213, 28); 75 | this.textBoxTime.TabIndex = 2; 76 | // 77 | // label1 78 | // 79 | this.label1.AutoSize = true; 80 | this.label1.Location = new System.Drawing.Point(411, 104); 81 | this.label1.Name = "label1"; 82 | this.label1.Size = new System.Drawing.Size(44, 18); 83 | this.label1.TabIndex = 3; 84 | this.label1.Text = "耗时"; 85 | // 86 | // label2 87 | // 88 | this.label2.AutoSize = true; 89 | this.label2.Location = new System.Drawing.Point(78, 104); 90 | this.label2.Name = "label2"; 91 | this.label2.Size = new System.Drawing.Size(44, 18); 92 | this.label2.TabIndex = 4; 93 | this.label2.Text = "学号"; 94 | // 95 | // buttonselect 96 | // 97 | this.buttonselect.Location = new System.Drawing.Point(164, 190); 98 | this.buttonselect.Name = "buttonselect"; 99 | this.buttonselect.Size = new System.Drawing.Size(100, 41); 100 | this.buttonselect.TabIndex = 5; 101 | this.buttonselect.Text = "查询"; 102 | this.buttonselect.UseVisualStyleBackColor = true; 103 | this.buttonselect.Click += new System.EventHandler(this.buttonselect_Click); 104 | // 105 | // panel1 106 | // 107 | this.panel1.Controls.Add(this.buttonselect); 108 | this.panel1.Controls.Add(this.buttondelete); 109 | this.panel1.Location = new System.Drawing.Point(12, 12); 110 | this.panel1.Name = "panel1"; 111 | this.panel1.Size = new System.Drawing.Size(776, 415); 112 | this.panel1.TabIndex = 7; 113 | // 114 | // MillonTest 115 | // 116 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); 117 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 118 | this.ClientSize = new System.Drawing.Size(800, 450); 119 | this.Controls.Add(this.buttoninsert); 120 | this.Controls.Add(this.label2); 121 | this.Controls.Add(this.label1); 122 | this.Controls.Add(this.textBoxTime); 123 | this.Controls.Add(this.textBoxSno); 124 | this.Controls.Add(this.panel1); 125 | this.Name = "MillonTest"; 126 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 127 | this.Text = "百万数据测试"; 128 | this.panel1.ResumeLayout(false); 129 | this.ResumeLayout(false); 130 | this.PerformLayout(); 131 | 132 | } 133 | 134 | #endregion 135 | 136 | private System.Windows.Forms.Button buttondelete; 137 | private System.Windows.Forms.TextBox textBoxSno; 138 | private System.Windows.Forms.TextBox textBoxTime; 139 | private System.Windows.Forms.Label label1; 140 | private System.Windows.Forms.Label label2; 141 | private System.Windows.Forms.Button buttonselect; 142 | private System.Windows.Forms.Panel panel1; 143 | private System.Windows.Forms.Button buttoninsert; 144 | } 145 | } -------------------------------------------------------------------------------- /StudentManager/StudentManager/ModifyStudentInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Data.SqlClient; 10 | 11 | namespace StudentManager 12 | { 13 | public partial class modifystuForm : Form 14 | { 15 | public modifystuForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) 21 | { 22 | 23 | } 24 | 25 | private void groupBox1_Enter(object sender, EventArgs e) 26 | { 27 | 28 | } 29 | 30 | private void groupBox2_Enter(object sender, EventArgs e) 31 | { 32 | 33 | } 34 | 35 | private void modifystuForm_Load(object sender, EventArgs e) 36 | { 37 | this.getRusult(); 38 | textBoxpage.Text = (page + 1).ToString(); 39 | } 40 | 41 | public static int page = 0; 42 | private void getRusult() 43 | { 44 | //SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY ID ASC) AS rowid,* FROM infoTab)t WHERE t.rowid > 100000 AND t.rowid <= 100050 45 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 46 | conn.Open(); 47 | string start_row, end_row; 48 | int start, end; 49 | start = page * 50; 50 | end = (page + 1) * 50; 51 | start_row = start.ToString(); 52 | end_row = end.ToString(); 53 | //textBox1.Text.Trim() textBox2.Text.Trim() 54 | string sql = "select Sid as 用户id,Sname as 真实姓名,Sno as 学号,Spassword as 密码,Sgrade as 年级,Smajor as 专业,Ssex as 性别,Sbirth as 出生日期,Shometown as 籍贯 from (SELECT ROW_NUMBER() OVER(ORDER BY Sid ASC) AS rowid,* FROM Student)t where t.rowid >= "+ start_row +" and t.rowid < " + end_row; 55 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 56 | DataSet ds = new DataSet(); 57 | adp1.Fill(ds); 58 | //载入基本信息 59 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 60 | textBoxpage.Text = (page + 1).ToString(); 61 | conn.Close(); 62 | } 63 | 64 | private void mos_click(object sender, DataGridViewCellMouseEventArgs e) 65 | { 66 | textBoxname.Text = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); 67 | textBoxborn.Text = dataGridView1.SelectedRows[0].Cells[7].Value.ToString(); 68 | comboBoxgrade.Text = dataGridView1.SelectedRows[0].Cells[4].Value.ToString(); 69 | textBoxhometown.Text = dataGridView1.SelectedRows[0].Cells[8].Value.ToString(); 70 | comboBoxmajor.Text = dataGridView1.SelectedRows[0].Cells[5].Value.ToString(); 71 | textBoxpasswd.Text = dataGridView1.SelectedRows[0].Cells[3].Value.ToString(); 72 | textBoxpname.Text = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); 73 | textBoxid.Text = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); 74 | string gender = dataGridView1.SelectedRows[0].Cells[6].Value.ToString(); 75 | 76 | if (gender == "男") 77 | { 78 | radioButton1.Select(); 79 | } 80 | else 81 | { 82 | radioButton2.Select(); 83 | } 84 | } 85 | 86 | private void textBoxname_TextChanged(object sender, EventArgs e) 87 | { 88 | 89 | } 90 | 91 | private void button1_Click(object sender, EventArgs e) 92 | { 93 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 94 | conn.Open(); 95 | string gender = radioButton1.Checked ? "男" : "女"; 96 | int id = 0; 97 | int.TryParse(textBoxid.Text, out id); 98 | //this.comboBoxrole.SelectedItem.ToString() 99 | string major = comboBoxmajor.SelectedItem.ToString(); 100 | string grade = comboBoxgrade.SelectedItem.ToString(); 101 | string sql = "update Student set Sname = '" + textBoxname.Text + "',Sbirth = '" + textBoxborn.Text + "' ,Sgrade = '" + grade + "' ,Shometown = '" + textBoxhometown.Text + "' ,Smajor = '" + major + "',Spassword = '" + textBoxpasswd.Text + "',Sno = '" + textBoxpname.Text + "',Ssex = '" + gender + "' where Sid = " + id; 102 | SqlCommand cmd = new SqlCommand(sql, conn); 103 | if (cmd.ExecuteNonQuery() > 0) 104 | { 105 | MessageBox.Show("更改成功!"); 106 | this.getRusult(); 107 | } 108 | conn.Close(); 109 | } 110 | 111 | private void button2_Click(object sender, EventArgs e) 112 | { 113 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 114 | conn.Open(); 115 | int id = 0; 116 | int.TryParse(textBoxid.Text, out id); 117 | string sql = "delete from Student where Sid = " + id; 118 | SqlCommand cmd = new SqlCommand(sql, conn); 119 | if (cmd.ExecuteNonQuery() > 0) 120 | { 121 | MessageBox.Show("删除成功!"); 122 | this.getRusult(); 123 | } 124 | 125 | conn.Close(); 126 | } 127 | 128 | private void button_select_Click(object sender, EventArgs e) 129 | { 130 | string Select_Sno = textBox_select_sno.Text.Trim(); 131 | if (Select_Sno == "") 132 | { 133 | MessageBox.Show("请输入要查询的学号!"); 134 | page = 0; 135 | this.getRusult(); 136 | 137 | } 138 | else 139 | { 140 | SqlConnection conn = new SqlConnection(loginForm.connectionString); 141 | conn.Open(); 142 | string sql = "select Sid as 用户id,Sname as 真实姓名,Sno as 学号,Spassword as 密码,Sgrade as 年级,Smajor as 专业,Ssex as 性别,Sbirth as 出生日期,Shometown as 籍贯 from Student where Sno = " + "'" + Select_Sno + "'"; 143 | SqlDataAdapter adp1 = new SqlDataAdapter(sql, conn); 144 | DataSet ds = new DataSet(); 145 | adp1.Fill(ds); 146 | //载入基本信息 147 | dataGridView1.DataSource = ds.Tables[0].DefaultView; 148 | textBoxpage.Text = "1"; 149 | conn.Close(); 150 | } 151 | } 152 | 153 | private void buttonnext_Click(object sender, EventArgs e) 154 | { 155 | page++; 156 | this.getRusult(); 157 | } 158 | 159 | private void buttonlast_Click(object sender, EventArgs e) 160 | { 161 | if (page == 0) 162 | { 163 | MessageBox.Show("已经是第1页!"); 164 | } 165 | else 166 | { 167 | page--; 168 | } 169 | this.getRusult(); 170 | } 171 | } 172 | } 173 | 174 | --------------------------------------------------------------------------------