数据库课程设计——学生信息管理系统(Sqlserver,C#,Winform)

这篇具有很好参考价值的文章主要介绍了数据库课程设计——学生信息管理系统(Sqlserver,C#,Winform)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

目录

需求分析

一.登录功能

二.注册功能

三.管理员登录后跳转到功能页面:

四.学生信息管理(主界面,删除功能在主界面代码中)

五.学生信息添加和修改(设计在一个页面上,修改需要选中行)

六.课程信息管理(删除功能在主界面中)

 七.课程信息添加和修改

 八.成绩信息管理(删除功能在主界面代码中)

九.成绩信息添加和修改

十.数据库设计


https://github.com/2736933896/StudentSystem,报告,项目源码,数据库设计,窗体设计源码上传到github,需要的同学自行下载哦

需求分析

1.1设计可视化界面,具有身份验证功能,需要登录时输入账号及密码。

1.2学生用户能够注册自己的账号,添加自己的基本注册信息:学号、密码、姓名、性别,对于学生除了基本注册信息外,还包括学生个人信息、课程信息、学生成绩信息。

1.3学生信息、课程信息、学生成绩都能实现增删改查并且符合符合数据库完整性。

(其他图文内容省略了,需要课程报告的私聊我)

一.登录功能

winform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;

namespace StudentSY
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 

        private void timer3_Tick(object sender, EventArgs e)
        {

           if(pictureBox2.Location.X<200)
            {
                pictureBox2.Location = new Point(pictureBox2.Location.X + 2, pictureBox2.Location.Y);
            }
           else
            {
                if(comboBox1.Text=="学生")
                {
                    Form4 form4 = new Form4();
                    form4.Show();
                }            
                timer3.Stop();
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if(login())
            {
                timer3.Start();
                textBox3.Visible = false;
                textBox4.Visible = false;
                comboBox1.Visible = false;
                button3.Visible = false;
                button4.Visible = false;
                button5.Visible = false;
                label4.Visible = false;
                label5.Visible = false;
                label6.Visible = false;
            }
        }

        private bool login()
        {
            if(textBox3.Text==null|| textBox4.Text==null)
            {
                MessageBox.Show("登录失败,账号或者密码为空","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return false;
            }
            else if (comboBox1.Text == "学生")
            {
                string sql = "select * from StudentUser where ID='" + textBox3.Text + "'and PassWord='" + textBox4.Text + "'";
                Dao dao = new Dao();
                IDataReader dr = dao.read(sql);
                if(dr.Read())
                {
                    return true;
                }
                else
                {
                    MessageBox.Show("登录失败!账号或者密码错误,请重试");
                    return false;
                }
            }
            return false;
        }
        private void button4_Click(object sender, EventArgs e)
        {
            textBox3.Text = null;
            textBox4.Text = null;
            comboBox1.Text = null;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Form11 form11 = new Form11();
            form11.ShowDialog();
        }
        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }

        
    }
}

二.注册功能

winform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudentSY
{
    public partial class Form11 : Form
    {
        public Form11()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if(textBox1.Text==""|| textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" )
            {
                MessageBox.Show("输入不完整,有空项,请检查!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
            }
            else
            {
                string sql= "insert into StudentUser values('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "')";
                Dao dao = new Dao();
                int i = dao.Excute(sql);
                if(i>0)
                {
                    MessageBox.Show("添加成功");
                    this.Close();
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = null;
            textBox2.Text = null;
            textBox3.Text = null;
            textBox4.Text = null;
        }
    }
}

三.管理员登录后跳转到功能页面:

winform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudentSY
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
            toolStripStatusLabel3.Text = DateTime.Now.ToString("G");
            timer1.Start();
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            toolStripStatusLabel3.Text = DateTime.Now.ToString("G");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.ShowDialog();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form3 form3 = new Form3();
            form3.ShowDialog();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Form31 form31 = new Form31();
            form31.ShowDialog();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}

四.学生信息管理(主界面,删除功能在主界面代码中)

winform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudentSY
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
            toolStripStatusLabel3.Text = DateTime.Now.ToString("G");
            timer1.Start();
            Table();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            toolStripStatusLabel3.Text = DateTime.Now.ToString("G");
        }

        public  void Table() //读取数据
        {
            string sql = "select * from Student";
            Dao dao = new Dao();
            IDataReader dr = dao.read(sql);
            while(dr.Read())
            {
                string Sno;
                string Sname;
                string Ssex, Sage, Sdept;
                Sno = dr["Sno"].ToString();
                Sname = dr["Sname"].ToString();
                Ssex = dr["Ssex"].ToString();
                Sage = dr["Sage"].ToString();
                Sdept = dr["Sdept"].ToString();
                string[] str = { Sno, Sname, Ssex, Sage, Sdept };
                dataGridView1.Rows.Add(str);
            }
            dr.Close();
        }
        
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Black;
        }

        private void dataGridView1_RowDefaultCellStyleChanged(object sender, DataGridViewRowEventArgs e)
        {
           ForeColor = Color.Black;
        }

        private void 添加学生ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form21 form21 = new Form21();
            form21.ShowDialog();  //开一个新窗口;
            dataGridView1.Rows.Clear();
            Table();
        }

        private void 修改学生信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {


                string[] str = { dataGridView1.SelectedCells[0].Value.ToString(), dataGridView1.SelectedCells[1].Value.ToString(),
                dataGridView1.SelectedCells[2].Value.ToString(),dataGridView1.SelectedCells[3].Value.ToString(),
                dataGridView1.SelectedCells[4].Value.ToString()};
                // MessageBox.Show(str[0]+str[1]+str[2]+str[3]+str[4]);
                Form21 form21 = new Form21(str);
                form21.ShowDialog();
                dataGridView1.Rows.Clear();
                Table();
            }
            catch
            {
                MessageBox.Show("未正确选中行,请重试");
            }
        }

        private void 删除学生信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);
            if(r==DialogResult.OK)
            {
                try
                {
                    string id, name;
                    id = dataGridView1.SelectedCells[0].Value.ToString(); //选中当前行第一列的值
                    name = dataGridView1.SelectedCells[0].Value.ToString();
                    string sql = "delete from Student where Sno=" + id;
                    Dao dao = new Dao();
                    int i = dao.Excute(sql); //执行SQL语句
                    if(i>0)
                    {
                        dataGridView1.Rows.Clear();
                        Table();
                    }
                }

                catch
                {
                    MessageBox.Show("请正确选择行");
                }
            }
           
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            Table();
        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            添加学生ToolStripMenuItem_Click(sender, e);
        }
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            删除学生信息ToolStripMenuItem_Click(sender, e);
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            修改学生信息ToolStripMenuItem_Click(sender, e);

;        }
    }
}

五.学生信息添加和修改(设计在一个页面上,修改需要选中行)

winform课程设计,项目制作,数据库,c#,sqlserverwinform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudentSY
{
    public partial class Form21 : Form
    {
        string []str = new string[5];
        public Form21()
        {
            InitializeComponent();
            button1.Text = "添加信息"; //更改button的值,用于增加和修改信息
        }

        public Form21(string[] a)
        {
            InitializeComponent();
            button1.Text = "修改信息";
            for(int i =0;i<5;i++)
            {
                str[i] = a[i];
            }
            textBox1.Text = str[0];
            textBox2.Text = str[1];
            textBox3.Text = str[2];
            textBox4.Text = str[3];
            textBox5.Text = str[4];
           // this.Close();
        }
        private void Form21_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (button1.Text == "添加信息")
            {
                if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
                {
                    MessageBox.Show("输入不完整,不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string sql = "insert into Student Values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')";

                    MessageBox.Show(sql);
                    Dao dao = new Dao();
                    int i = dao.Excute(sql);
                    if (i > 0)
                    {
                        MessageBox.Show("添加成功");
                        this.Close();
                    }
                
                }
            }
            else if (button1.Text == "修改信息")
            {
                if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
                {
                    MessageBox.Show("修改后有空项,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string sql = "update Student set Sno='"+textBox1.Text+"' ,Sname ='"+textBox2.Text+"',Ssex='"+textBox3.Text+"',Sage='"+textBox4.Text+"',Sdept='"+textBox5.Text+"' where Sno = '" + str[0] +"';";
                    Dao dao = new Dao();
                    int i = dao.Excute(sql);
                    if (i > 0)
                    {
                        MessageBox.Show("修改成功");
                        this.Close();
                    }
                }
            }

        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

六.课程信息管理(删除功能在主界面中)

winform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudentSY
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
            toolStripStatusLabel3.Text = DateTime.Now.ToString("G");
            timer1.Start();
            Table();
        }

        public void Table()
        {
            string sql = "select * from Course";
            Dao dao = new Dao();
            IDataReader dr = dao.read(sql);
            while (dr.Read())
            {
                string Cno, Cname, Cpno, Credit;
                Cno = dr["Cno"].ToString();
                Cname = dr["Cname"].ToString();
                Cpno = dr["Cpno"].ToString();
                Credit = dr["Credit"].ToString();
                string[] str = { Cno, Cname, Cpno, Credit };
                dataGridView1.Rows.Add(str);
            }
            dr.Close();
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            toolStripStatusLabel3.Text = DateTime.Now.ToString("G");
        }

        private void 添加课程ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            addcourse addcourse = new addcourse();
            addcourse.ShowDialog();
            dataGridView1.Rows.Clear();
            Table();
        }
        private void 修改课程ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string[] str = { dataGridView1.SelectedCells[0].Value.ToString(), dataGridView1.SelectedCells[1].Value.ToString(),
                dataGridView1.SelectedCells[2].Value.ToString(),dataGridView1.SelectedCells[3].Value.ToString()};
                addcourse addcourse = new addcourse(str);
                addcourse.ShowDialog();
                dataGridView1.Rows.Clear();
                Table();
            }
            catch
            {
                MessageBox.Show("未正确选择行,请重试");
            }
        }
       

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            Table();
        }

        private void 删除课程ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);
            if (r == DialogResult.OK)
            {
                try
                {
                    string id;
                    id = dataGridView1.SelectedCells[0].Value.ToString(); //选中当前行第一列的值
                  //  name = dataGridView1.SelectedCells[0].Value.ToString();
                    string sql = "delete from Course where Cno=" + id;
                    Dao dao = new Dao();
                    int i = dao.Excute(sql); //执行SQL语句
                    if (i > 0)
                    {
                        dataGridView1.Rows.Clear();
                        Table();
                    }
                }

                catch
                {
                    MessageBox.Show("请正确选择行");
                }
            }
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            添加课程ToolStripMenuItem_Click(sender, e);
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            修改课程ToolStripMenuItem_Click(sender, e);
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            删除课程ToolStripMenuItem_Click(sender, e);
        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

       
    }
}

 七.课程信息添加和修改

winform课程设计,项目制作,数据库,c#,sqlserverwinform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace StudentSY
{
    public partial class addcourse : Form
    {
        string[] str=new string[4];
        public addcourse()
        {
            InitializeComponent();
            button1.Text = "添加信息";

        }

        public addcourse(string[] a)
        {
            InitializeComponent();
            button1.Text = "修改信息";
            for (int i = 0; i < 4; i++)
            {
                str[i] = a[i];
            }
            textBox1.Text = str[0];
            textBox2.Text = str[1];
            textBox3.Text = str[2];
            textBox4.Text = str[3];
         
            // this.Close();
        }

       
        private void button1_Click(object sender, EventArgs e)
        {
                if (button1.Text == "添加信息")
                {
                    if (textBox1.Text == "" || textBox2.Text == ""  || textBox4.Text == "")
                    {
                        MessageBox.Show("除先修课外输入不完整,不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        string sql = "insert into Course Values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')";

                        MessageBox.Show(sql);
                        Dao dao = new Dao();
                        int i = dao.Excute(sql);
                        if (i > 0)
                        {
                            MessageBox.Show("添加成功");
                            this.Close();
                        }

                    }
                }
                else if (button1.Text == "修改信息")
                {
                    if (textBox1.Text == "" || textBox2.Text == "" ||  textBox4.Text == "" )
                    {
                        MessageBox.Show("除先修课外修改后有空项,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        string sql = "update Course set Cno='" + textBox1.Text + "' ,Cname ='" + textBox2.Text + "',Cpno='" + textBox3.Text + "',Credit='" + textBox4.Text + "'  where Cno = '" + str[0] + "';";
                        Dao dao = new Dao();
                        int i = dao.Excute(sql);
                        if (i > 0)
                        {
                            MessageBox.Show("修改成功");
                            this.Close();
                        }
                    }
                }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}

 八.成绩信息管理(删除功能在主界面代码中)

winform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudentSY
{
    public partial class Form31 : Form
    {
        public Form31()
        {
            InitializeComponent();
            Table();
        }

        public void Table()
        {
            string sql = "select * from SC";
            Dao dao = new Dao();
            IDataReader dr = dao.read(sql);
            while (dr.Read())
            {
                string Sno,Cno,Grade;
                Sno = dr["Sno"].ToString();
                Cno = dr["Cno"].ToString();
                Grade = dr["Grade"].ToString();
                string[] str = { Sno,Cno, Grade};
                dataGridView2.Rows.Add(str);
            }
            dr.Close();
        }

        private void 添加成绩ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            addgrade addgrade = new addgrade();
            addgrade.ShowDialog();
            dataGridView2.Rows.Clear();
            Table();
        }

        private void 删除成绩ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);
            if (r == DialogResult.OK)
            {
                try
                {
                    string sno,cno;
                    sno = dataGridView2.SelectedCells[0].Value.ToString(); //选中当前行第一列的值
                    cno= dataGridView2.SelectedCells[1].Value.ToString();                                             //  name = dataGridView1.SelectedCells[0].Value.ToString();
                    string sql = "delete from SC where Sno= '"+sno+"' and Cno='"+cno+"'";
                    Dao dao = new Dao();
                    int i = dao.Excute(sql); //执行SQL语句
                    if (i > 0)
                    {
                        dataGridView2.Rows.Clear();
                        Table();
                    }
                }

                catch
                {
                    MessageBox.Show("请正确选择行");
                }
            }
        }

        private void 修改成绩ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string[] str = { dataGridView2.SelectedCells[0].Value.ToString(), dataGridView2.SelectedCells[1].Value.ToString(),
                dataGridView2.SelectedCells[2].Value.ToString()};
                addgrade addgrade = new addgrade(str);
                addgrade.ShowDialog();
                dataGridView2.Rows.Clear();
                Table();
            }
            catch
            {
                MessageBox.Show("未正确选择行,请重试");
            }
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            添加成绩ToolStripMenuItem_Click(sender, e);
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            修改成绩ToolStripMenuItem_Click(sender, e);
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            删除成绩ToolStripMenuItem_Click(sender, e);
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            dataGridView2.Rows.Clear();
            Table();
        }

        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}

九.成绩信息添加和修改

winform课程设计,项目制作,数据库,c#,sqlserverwinform课程设计,项目制作,数据库,c#,sqlserver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace StudentSY
{
    public partial class addgrade : Form
    {
        string []str = new string[3];
        public addgrade()
        {
            InitializeComponent();
            button1.Text = "添加信息";
        }

        public addgrade(string[] a)
        {
            InitializeComponent();
            button1.Text = "修改信息";
            for (int i = 0; i < 3; i++)
            {
                str[i] = a[i];
            }
            textBox1.Text = str[0];
            textBox2.Text = str[1];
            textBox3.Text = str[2];
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (button1.Text == "添加信息")
            {
                if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
                {
                    MessageBox.Show("输入不完整,不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string sql = "insert into SC Values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "')";

                    MessageBox.Show(sql);
                    Dao dao = new Dao();
                    int i = dao.Excute(sql);
                    if (i > 0)
                    {
                        MessageBox.Show("添加成功");
                        this.Close();
                    }

                }
            }
            else if (button1.Text == "修改信息")
            {
                if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
                {
                    MessageBox.Show("修改后有空项,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string sql = "update SC set Grade='" + textBox3.Text + "'  where Sno = '" + str[0] + "' and Cno ='" + str[1] +"';";
                    Dao dao = new Dao();
                    int i = dao.Excute(sql);
                    if (i > 0)
                    {
                        MessageBox.Show("修改成功");
                        this.Close();
                    }
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

十.数据库设计

USE MySchool;
DROP TABLE IF EXISTS SC       /*成绩*/
DROP TABLE IF EXISTS Student  /*学生信息*/
DROP TABLE IF EXISTS Course   /*课程*/
DROP TABLE IF EXISTS StudentUser  /*学生用户信息*/
DROP TABLE IF EXISTS Administrator  /*管理员用户信息*/
DROP TABLE IF EXISTS SysLog   /*注册日志*/
DROP TABLE IF EXISTS SysLog1   /*登陆日志*/
DROP TABLE IF EXISTS AVG1   /*平均成绩*/

Create table StudentUser  --学生注册信息表格
(ID nchar(20) primary key,
 PassWord nchar(32),
 Name nchar(20),
 Sex nchar(2),
 );

 Create table Administrator  --管理员注册信息表格
 (
 ID char(20) primary key,
 PassWord nchar(32),
 Name nchar(20),
 Sex char(2),
-- Birthday datetime ,
 --UserMobile nchar(11),
 );

Create table Student      --学生信息表格
(
Sno char(9) primary key,  --列级完整性约束条件,Sno是主码
Sname char(20) Unique,    --名字唯一
Ssex char(2),
Sage int,
Sdept char(20),
);

Create table Course
(
Cno char(9) primary key,  --列级完整性约束条件,Cno是主码
Cname char(40),
cpno char(4),
Credit int,
);

 
create table  SC
 (
 Sno char(9), 
 Cno char(9),  
 Grade int,
 primary key (Sno,Cno),                     --主码由两个属性构成,必须作为表级完整性进行定义
 foreign key (Sno) references Student(Sno),  --表级完整性约束条件,Sno是外码,被参照表是Student 
 foreign key (Cno) references Course(Cno)     --表级完整性约束条件, Cno是外码,被参照表是Course
 ); 
INSERT  INTO  StudentUser VALUES ('2023123','123456','张三','男');
INSERT  INTO  Administrator VALUES ('2023124','123456','张三','男');
INSERT  INTO  Administrator VALUES ('2023125','123456','张三','男');
 
 
INSERT  INTO  Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215121','李勇','男','CS',20);
INSERT  INTO  Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215122','刘晨','女','CS',19);
INSERT  INTO  Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215123','王敏','女','MA',18);
INSERT  INTO  Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215125','张立','男','IS',19);
INSERT  INTO  Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215128','陈冬','男','IS',20);
 
SELECT * FROM Student
 
INSERT  INTO Course(Cno,Cname,Cpno,Credit)	VALUES ('1','数据库',NULL,4);
INSERT  INTO Course(Cno,Cname,Cpno,Credit)	VALUES ('2','数学',NULL,4);
INSERT  INTO Course(Cno,Cname,Cpno,Credit)	VALUES ('3','信息系统',NULL,4);
INSERT  INTO Course(Cno,Cname,Cpno,Credit)	VALUES ('4','操作系统',NULL,4);
INSERT  INTO Course(Cno,Cname,Cpno,Credit)	VALUES ('5','数据结构',NULL,4);
INSERT  INTO Course(Cno,Cname,Cpno,Credit)	VALUES ('6','数据处理',NULL,4);
INSERT  INTO Course(Cno,Cname,Cpno,Credit)	VALUES ('7','Pascal语言',NULL,4);
 
UPDATE Course SET Cpno = '5' WHERE Cno = '1' 
UPDATE Course SET Cpno = '1' WHERE Cno = '3' 
UPDATE Course SET Cpno = '6' WHERE Cno = '4' 
UPDATE Course SET Cpno = '7' WHERE Cno = '5' 
UPDATE Course SET Cpno = '6' WHERE Cno = '7' 
 
SELECT * FROM Course
 
INSERT  INTO SC(Sno,Cno,Grade) VALUES ('201215121 ','1',92);
INSERT  INTO SC(Sno,Cno,Grade) VALUES ('201215121 ','2',85);
INSERT  INTO SC(Sno,Cno,Grade) VALUES ('201215121 ','3',88);
INSERT  INTO SC(Sno,Cno,Grade) VALUES ('201215122 ','2',90);
INSERT  INTO SC(Sno,Cno,Grade) VALUES ('201215122 ','3',80);
 
SELECT * FROM SC

CREATE TABLE AVG1
	(
		Cname CHAR(10),   /* 科目*/	
		avg1 INT
	);
INSERT  INTO AVG1(Cname,avg1)	VALUES ('数据库',NULL);
INSERT  INTO AVG1(Cname,avg1)	VALUES ('数学',NULL);
INSERT  INTO AVG1(Cname,avg1)	VALUES ('信息系统',NULL);
INSERT  INTO AVG1(Cname,avg1)	VALUES ('操作系统',NULL);
INSERT  INTO AVG1(Cname,avg1)	VALUES ('数据结构',NULL);
INSERT  INTO AVG1(Cname,avg1)	VALUES ('数据处理',NULL);
INSERT  INTO AVG1(Cname,avg1)	VALUES ('Pascal语言',NULL);

学生信息表(Student):
winform课程设计,项目制作,数据库,c#,sqlserver

课程表(Course):
winform课程设计,项目制作,数据库,c#,sqlserver

成绩表(SC):

winform课程设计,项目制作,数据库,c#,sqlserver

学生用户表(StudentUser):
winform课程设计,项目制作,数据库,c#,sqlserver

 有需要完整代码和实验报告的同学私聊我,有什么问题评论文章来源地址https://www.toymoban.com/news/detail-786304.html

到了这里,关于数据库课程设计——学生信息管理系统(Sqlserver,C#,Winform)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 数据库原理及应用课程设计--药品存储信息管理系统

    1.1项目提出 1.2.调查使用该药品存储信息数据库的用户的实际需求 1.3 功能需求 1.供应商基本信息模块,完成对供应商基本信息的输入、修改和查询; 2.员工基本信息模块,完成对员工基本情况的输入、修改和查询; 3.药品基本信息模块,完成对药品基本信息的输入、修改

    2024年02月08日
    浏览(28)
  • 【数据库技术课程设计】 电信学院考研信息管理系统 +【Visual FoxPro】

    一 、系统设计背景        二、系统可行性分析 2.1 经济可行性 2.2 技术可行性 2.3 操作可行性 2.4 可行性分析总结 三、软件选择与编程环境 3.1 软件选择 3.2 编程环境 四、系统总体结构设计 五、数据库设计及表链接 5.1 表设计 5.2 表连接 六、信息浏览的实现 6.1 表单设计

    2024年02月04日
    浏览(27)
  • [Python+Django]Web学生信息管理系统数据库设计及系统实现

    本文我们完成数据的设计,并通过Django框架完成数据库构建同时利用Django框架模式实现学生信息管理系统的功能。 简单的包装下毕设应该没问题了。 Python,Mysql,Pycharm的安装本文就不做特别介绍了,有需要的同学请参考如下博文。 Python + Django4 搭建个人博客(二):准备开

    2024年02月03日
    浏览(48)
  • 数据库课程设计-学生选课管理系统(实训报告+答辩ppt+源码+sql文件+打包好的程序)springboot项目-javaweb

    作者:ChenZhen 博客地址:https://www.chenzhen.space/ 版权:本文为博主 ChenZhen 的原创文章,本文版权归作者所有,转载请附上原文出处链接及本声明。 如果对你有帮助,请给一个小小的star⭐ 源码加vx : ChenZhen_7 (实训报告+答辩ppt+源码+sql文件+打包好的程序 无套路 免费获取! 不放

    2024年02月11日
    浏览(54)
  • 学生信息管理系统(数据库)

    要求实现功能: (1)学生、课程、教师等信息的录入和维护,一门课只由一位教师上,一位教师可上多门课 (2)学生进行选课,一学期约20学分 (3)教师在每门课结束后给出学生成绩,不及格则补考后记录补考成绩 (4)能明细查询某学生的选课情况及某课程的选修学生情

    2024年02月03日
    浏览(32)
  • JAVA学生信息管理系统(数据库实现)

    这次的项目是用数据库实现学生的信息管理系统,有三步组成,写项目链接数据库实现相关的操作 开发工具: eclipse、MySQL、navicat、mysql-connector-java-8.0.27     (1)主页面   (2)添加界面   (3)删除界面    (4)修改界面  (5)查找界面 (6)数据库链接   添加Java驱动包

    2024年02月11日
    浏览(29)
  • 利用java和mysql数据库创建学生信息管理系统

    管理系统的使用可以大大提高我们的工作效率,给我们的生活带来极大的便利,因此我们在学习编程语言的时候大多是要学习和实现一个管理系统的创建的。 学生信息管理系统是进一步推进学生学籍管理规范化、电子化控制和管理学生信息的总要举措。系统针对学校学生信息

    2024年02月04日
    浏览(42)
  • 学生信息及成绩管理系统(Python+Sqlite)数据库版

    目录 功能模块: 运行功能演示:  具体代码实现过程: 创建sqlite 数据库  Python代码 引入os和sqlite3包: 初始化数据库: 连接数据库: 关闭并提交数据到数据库: 查询数据并显示: 添加并插入数据到数据库: 更新数据到数据库: 删除数据并更新数据库:  导入和导出数据

    2024年02月04日
    浏览(32)
  • 数据库系统课程设计(高校成绩管理数据库系统的设计与实现)

    目录 1、需求分析 1 1.1 数据需求描述 1 1.2 系统功能需求 3 1.3 其他性能需求 4 2、概念结构设计 4 2.1 局部E-R图 4 2.2 全局E-R图 5 2.3 优化E-R图 6 3、逻辑结构设计 6 3.1 关系模式设计 6 3.2 数据类型定义 6 3.3 关系模式的优化 8 4、物理结构设计 9 4.1 聚簇设计 9 4.2 索引设计 9 4.3 分区设

    2024年02月03日
    浏览(51)
  • 数据库课程设计-人事管理系统

    学期就要结束了,要完成一个数据库的课程设计项目,想想自己一个学期下来啥也没学到,现在突然要独立完成一个小项目,不能偷懒,记录一下吧。 代码已经放在文章末尾 ^ v ^ 完成软件下载与环境配置,成功运行老师写好的学生管理系统。  第一次实现用代码弹出具体的

    2024年02月05日
    浏览(36)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包