大学数据库课程设计–一个简单的学生选课系统

一、系统简介

一个超级简单的学生选课系统,使用Windows窗体设计界面,使用C#语言实现各种功能,数据库使用的是SQL。由于时间原因,做的非常仓促,系统中没有查询功能,能够实现数据的增删改。下面开始系统演示吧。

二、系统演示

1、登录界面

我使用Windows窗体设计成这个样子 看着还算不错,嘻嘻。

    public partial class Form1 : Form{public Form1(){InitializeComponent();}private void timer1_Tick(object sender, EventArgs e){if(pictureBox1.Location.X<150){pictureBox1.Location = new Point(pictureBox1.Location.X + 1, pictureBox1.Location.Y);}//图标移动else{if(comboBox1.Text == "学生"){string sql = "select * from Stu where Name = '" + textBox1.Text + "'and Password ='" + textBox2.Text + "'";Dao dao = new Dao();IDataReader dr = dao.read(sql);dr.Read();string Sid = dr["ID"].ToString();Form3 form3 = new Form3(Sid);form3.Show();//显示这个窗体this.Hide();//隐藏这个窗体}else{if(comboBox1.Text == "老师"){string sql = "select * from Teacher where Name = '" + textBox1.Text + "'and Password ='" + textBox2.Text + "'";Dao dao = new Dao();IDataReader dr = dao.read(sql);dr.Read();string Tid = dr["ID"].ToString();Form7 form7 = new Form7(Tid);form7.Show();this.Hide();}else{if(comboBox1.Text == "管理员"){Form5 form5 = new Form5();form5.Show();this.Hide();}}}timer1.Stop();}}//判断是否登录private string login(){if(textBox1.Text == ""||textBox2.Text == ""||comboBox1.Text == ""){MessageBox.Show("输入不完整,请检查","提示",MessageBoxButtons.OK, MessageBoxIcon.Warning);}if(comboBox1.Text == "学生"){string sql = "select * from Stu where Name = '" +textBox1.Text+ "'and Password ='" +textBox2.Text+ "'";Dao dao = new Dao();IDataReader dr = dao.read(sql);if(dr.Read()){return "学生";}else{MessageBox.Show("用户名或密码错误");return "-1";}}if(comboBox1.Text == "老师"){string sql = "select * from Teacher where Name = '" +textBox1.Text+ "'and Password ='" +textBox2.Text+ "'";Dao dao = new Dao();IDataReader dr = dao.read(sql);if (dr.Read()){return "老师";}else{MessageBox.Show("用户名或密码错误");return "-1";}}if(comboBox1.Text == "管理员"){if(textBox1.Text == "admin"&&textBox2.Text == "admin"){return "管理员";}else{MessageBox.Show("用户名或密码错误");return "-1";}}return "-1";}private void button2_Click(object sender, EventArgs e){textBox1.Text = null;textBox2.Text = null;comboBox1.Text = null;}private void textBox1_TextChanged(object sender, EventArgs e){}//登录事件private void button1_Click_1(object sender, EventArgs e){if (login() != "-1"){timer1.Start();//启动计时器控件,图片开始移动textBox1.Visible = false;textBox2.Visible = false;comboBox1.Visible = false;label1.Visible = false;label2.Visible = false;label3.Visible = false;}else{MessageBox.Show("信息错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);}}private void comboBox1_SelectedIndexChanged(object sender, EventArgs e){}private void Form1_FormClosed(object sender, FormClosedEventArgs e){Application.Exit();//强行结束整个程序}}

上述为系统登录的代码,请结合一些注释理解。系统登录界面,有三个权限,分别为学生、老师及管理员,在代码中,都有对应的代码 ,请仔细看。

2、学生操作界面

 public partial class Form3 : Form{string SID;public Form3(string Sid){SID = Sid;InitializeComponent();toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//显示当前时间toolStripStatusLabel1.Text = "欢迎学号为" + SID + "的同学登录选课系统";timer1.Start();Table();}public void Table(){dataGridView1.Rows.Clear();string sql = "select * from Course";Dao dao = new Dao();IDataReader dr = dao.read(sql);while (dr.Read()){string a, b, c, d;a = dr["ID"].ToString();b = dr["Name"].ToString();c = dr["Credit"].ToString();d = dr["Teacher"].ToString();string[] str = { a, b, c, d};dataGridView1.Rows.Add(str);}dr.Close();//关闭链接}private void timer1_Tick(object sender, EventArgs e){toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//显示当前时间}private void Form3_FormClosed(object sender, FormClosedEventArgs e){Application.Exit();//强行结束整个程序}private void 选课ToolStripMenuItem_Click(object sender, EventArgs e){string Cid = dataGridView1.SelectedCells[0].Value.ToString();//获取选中得课程号string sql1 = "Select * from  CourseChoose where Sid = '"+SID+"' and Cid = '"+Cid+"'";Dao dao = new Dao();IDataReader dc = dao.read(sql1);if(!dc.Read()){               string sql = "Insert into CourseChoose values('" + SID + "','" + Cid + "')";int i = dao.Execute(sql);if(i>0){MessageBox.Show("选课成功");}}else{MessageBox.Show("不允许重复选课");}}private void 我的课程ToolStripMenuItem_Click(object sender, EventArgs e){Form31 f = new Form31(SID);f.Show();}private void 退出ToolStripMenuItem_Click(object sender, EventArgs e){Form1 form1 = new Form1();form1.Show();//显示这个窗体this.Hide();//隐藏这个窗体}private void 修改个人密码ToolStripMenuItem_Click(object sender, EventArgs e){Form32 f = new Form32(SID);f.ShowDialog();}}

 public partial class Form31 : Form{   string SID;public Form31(string Sid){SID = Sid;InitializeComponent();Table();}public void Table(){dataGridView1.Rows.Clear();string sql = "select * from CourseChoose where Sid = '"+SID+"'";Dao dao = new Dao();IDataReader dr = dao.read(sql);while (dr.Read()){string CID = dr["Cid"].ToString();string sql2 = "select* from Course where ID= '" + CID + "'";IDataReader dr2 = dao.read(sql2);dr2.Read();string a, b, c, d;a = dr2["ID"].ToString();b = dr2["Name"].ToString();c = dr2["Credit"].ToString();d = dr2["Teacher"].ToString();string[] str = { a, b, c, d };dataGridView1.Rows.Add(str);dr2.Close();}dr.Close();//关闭链接}private void Form31_Load(object sender, EventArgs e){}private void 取消这门课ToolStripMenuItem_Click(object sender, EventArgs e){DialogResult r = MessageBox.Show("确定要取消吗?", "提示", MessageBoxButtons.OKCancel);if (r == DialogResult.OK){string Cid = dataGridView1.SelectedCells[0].Value.ToString();string sql = "delete CourseChoose where Sid = '" + SID + "' and Cid ='" + Cid + "'";Dao dao = new Dao();dao.Execute(sql);Table();}}}

public partial class Form32 : Form{string SID;public Form32(){InitializeComponent();}public Form32(string Sid){InitializeComponent();SID = Sid;string sql = "select * from Stu where ID = '" + SID + "'";Dao dao = new Dao();IDataReader dr = dao.read(sql);dr.Read();textBox1.Text = dr["PassWord"].ToString();dr.Close();}private void button1_Click(object sender, EventArgs e){string sql = "Update Stu set Password = '" + textBox2.Text +"'where ID = '"+SID+"'";Dao dao = new Dao();int i = dao.Execute(sql);if(i>0){MessageBox.Show("修改成功");}this.Hide();//隐藏这个窗体}private void Form32_FormClosed(object sender, FormClosedEventArgs e){Application.Exit();//强行结束整个程序}}

上述三个窗体为学生操作面,在第一张主操作界面,点击不同的按钮,会跳转至不同的操作界面, 窗体下给出控制代码.

3、老师操作界面

public partial class Form7 : Form{string TID;public Form7(string Tid){TID = Tid;InitializeComponent();toolStripStatusLabel1.Text = "欢迎工号为" + TID + "的老师登录选课系统";Table();}public void Table(){dataGridView1.Rows.Clear();string sql = "select * from Teacher where ID = '"+TID+"'";Dao dao = new Dao();IDataReader dr = dao.read(sql);while (dr.Read()){string NAME = dr["Name"].ToString();string sql2 = "select* from Course where Teacher= '" + NAME + "'";IDataReader dr2 = dao.read(sql2);dr2.Read();string a, b, c;a = dr2["ID"].ToString();b = dr2["Name"].ToString();c = dr2["Credit"].ToString();string[] str = { a, b, c};dataGridView1.Rows.Add(str);}dr.Close();//关闭链接}private void 修改个人密码ToolStripMenuItem_Click(object sender, EventArgs e){Form8 f = new Form8(TID);f.ShowDialog();}private void 系统退出ToolStripMenuItem_Click(object sender, EventArgs e){Form1 form1 = new Form1();form1.Show();//显示这个窗体this.Hide();//隐藏这个窗体}private void Form7_FormClosed(object sender, FormClosedEventArgs e){Application.Exit();//强行结束整个程序}}

  public partial class Form8 : Form{string TID;public Form8(){InitializeComponent();}public Form8(string Tid){InitializeComponent();TID = Tid;string sql = "select * from Teacher where ID = '" + TID + "'";Dao dao = new Dao();IDataReader dr = dao.read(sql);dr.Read();textBox1.Text = dr["PassWord"].ToString();dr.Close();}private void button1_Click(object sender, EventArgs e){string sql = "Update Teacher set Password = '" + textBox2.Text + "'where ID = '" + TID + "'";Dao dao = new Dao();int i = dao.Execute(sql);if (i > 0){this.Hide();MessageBox.Show("修改成功");}this.Hide();//隐藏这个窗体}  }

上述两个窗体为老师操作界面,在第一张主操作界面,点击不同的按钮,会跳转至不同的操作界面, 窗体下给出控制代码。老师操作界面功能比较少。

4、管理员操作界面

 public partial class Form5 : Form{public Form5(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){Form2 form2 = new Form2();form2.Show();//显示这个窗体this.Hide();}private void button2_Click(object sender, EventArgs e){Form4 form4 = new Form4();form4.Show();//显示这个窗体this.Hide();}private void button3_Click(object sender, EventArgs e){Form6 form6 = new Form6();form6.Show();//显示这个窗体this.Hide();}private void button4_Click(object sender, EventArgs e){Form1 form1 = new Form1();form1.Show();//显示这个窗体this.Hide();}}

public partial class Form2 : Form{public Form2(){InitializeComponent();toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//显示当前时间timer1.Start();Table();}private void Form2_FormClosed(object sender, FormClosedEventArgs e){Application.Exit();//强行结束整个程序}//让表显示数据public void Table(){dataGridView1.Rows.Clear();string sql = "select * from Stu";Dao dao = new Dao();IDataReader dr = dao.read(sql);while (dr.Read()){string a, b, c, d, e;a = dr["ID"].ToString();b = dr["Name"].ToString();c = dr["Sex"].ToString();d = dr["Class"].ToString();e = dr["Dept"].ToString();string[] str = { a, b, c, d, e };dataGridView1.Rows.Add(str);}dr.Close();//关闭链接}private void 添加学生信息ToolStripMenuItem_Click(object sender, EventArgs e){Form21 f = new Form21(this);f.ShowDialog();//添加学生信息的窗体}private void 修改学生信息ToolStripMenuItem_Click(object sender, EventArgs e){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() };Form21 f = new Form21(str,this); f.ShowDialog(); }private void 退出ToolStripMenuItem_Click(object sender, EventArgs e){Form5 form5 = new Form5();form5.Show();//显示这个窗体this.Hide();//隐藏这个窗体}private void 删除学生信息ToolStripMenuItem_Click(object sender, EventArgs e){DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);if(r == DialogResult.OK){string id, name;id = dataGridView1.SelectedCells[0].Value.ToString();name = dataGridView1.SelectedCells[1].Value.ToString();string sql = "delete from Stu where ID = '" + id + "'and Name = '" + name + "'";Dao dao = new Dao();dao.Execute(sql);dataGridView1.Rows.Clear();Table();}}private void 刷新ToolStripMenuItem_Click(object sender, EventArgs e){dataGridView1.Rows.Clear();Table();}}


  public partial class Form21 : Form{Form2 form2;string[] str = new string[5];public Form21(Form2 f){InitializeComponent();button5.Visible = false; //插入时 隐藏修改  form2 = f;}//用于修改 参数位于一个数组public Form21(string[] a,Form2 f) {InitializeComponent();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];button1.Visible = false;//修改时 隐藏插入form2 = f; }private void Form21_Load(object sender, EventArgs e){}private void label5_Click(object sender, EventArgs e){}//添加一条学生事件private void button1_Click(object sender, EventArgs e){if(textBox1.Text==""||textBox2.Text==""||textBox3.Text==""||textBox4.Text==""||textBox5.Text==""){MessageBox.Show("输入不完整,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);}else{string sql = "Insert into Stu values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','123456')";Dao dao = new Dao();int i = dao.Execute(sql);if (i > 0){MessageBox.Show("插入成功");textBox1.Text = null;textBox2.Text = null;textBox3.Text = null;textBox4.Text = null;textBox5.Text = null;}form2.Table();this.Hide();}}private void button2_Click(object sender, EventArgs e){textBox1.Text = null;textBox1.Text = null;textBox1.Text = null;textBox1.Text = null;textBox1.Text = null;textBox1.Text = null;}private void textBox3_TextChanged(object sender, EventArgs e){}private void button5_Click(object sender, EventArgs e){if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == ""){MessageBox.Show("修改后有空项,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);}else{if(textBox1.Text!=str[0]){string sql = "update Stu set ID = '"+textBox1.Text+"'where ID = '"+str[0]+"' and Name = '"+str[1]+"'";Dao dao = new Dao();dao.Execute(sql);str[0] = textBox1.Text;}if (textBox2.Text != str[1]){string sql = "update Stu set Name = '" + textBox2.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";Dao dao = new Dao();dao.Execute(sql);str[1] = textBox2.Text;}if (textBox3.Text != str[2]){string sql = "update Stu set Sex = '" + textBox3.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";Dao dao = new Dao();dao.Execute(sql);str[2] = textBox3.Text;}if (textBox4.Text != str[3]){string sql = "update Stu set Class= '" + textBox4.Text+ "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";Dao dao = new Dao();dao.Execute(sql);str[3] = textBox4.Text;}if (textBox5.Text != str[4]){string sql = "update Stu set Dept = '" + textBox5.Text+ "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";Dao dao = new Dao();dao.Execute(sql);str[4] = textBox5.Text;}form2.Table();this.Hide();}}private void Form21_FormClosed(object sender, FormClosedEventArgs e){Application.Exit();//强行结束整个程序}}

public partial class Form41 : Form   {        Form4 form4;        string[] str = new string[5];        public Form41(Form4 f)        {            InitializeComponent();            button3.Visible = false; //插入时 隐藏修改             form4 = f;        }        //用于修改 参数位于一个数组       public Form41(string[] a,Form4 f)        {            InitializeComponent(); 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];         button1.Visible = false;//修改时 隐藏插入           form4 = f;  }        //添加一条学生信息        private void button1_Click(object sender, EventArgs e)        {            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")            {                MessageBox.Show("输入不完整,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);            }            else            {                string sql = "Insert into Teacher values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','123456')";                                 Dao dao = new Dao();                int i = dao.Execute(sql);               if (i > 0)               {                    MessageBox.Show("插入成功");                    textBox1.Text = null;                    textBox2.Text = null;                    textBox3.Text = null;                    textBox4.Text = null;                    textBox5.Text = null;                }                form4.Table();                this.Hide();            }        }         private void button2_Click(object sender, EventArgs e)        {            textBox1.Text = null;            textBox2.Text = null;            textBox3.Text = null;            textBox4.Text = null;           textBox5.Text = null;                   }        private void button3_Click(object sender, EventArgs e)        {            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")            {                MessageBox.Show("修改后有空项,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);               }           else            {                if (textBox1.Text != str[0])                {                    string sql = "update Teacher set ID = '" + textBox1.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                   Dao dao = new Dao();                   dao.Execute(sql);                    str[0] = textBox1.Text;               }                if (textBox2.Text != str[1])                {                    string sql = "update Teacher set Name = '" + textBox2.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                   Dao dao = new Dao();                    dao.Execute(sql);                    str[1] = textBox2.Text;                }                if (textBox3.Text != str[2])                {                    string sql = "update Teacher set Sex = '" + textBox3.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                    Dao dao = new Dao();                    dao.Execute(sql);                    str[2] = textBox3.Text;               }                if (textBox4.Text != str[3])                {                    string sql = "update Teacher set Dept= '" + textBox4.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                   Dao dao = new Dao();                    dao.Execute(sql);                    str[3] = textBox4.Text;                }                if (textBox5.Text != str[4])                {                    string sql = "update Teacher set Zc = '" + textBox5.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                   Dao dao = new Dao();                    dao.Execute(sql);                   str[4] = textBox5.Text;               }                form4.Table();                this.Hide();            }       }    }

 public partial class Form6 : Form    {        public Form6()        {            InitializeComponent();                         Table();        }        public void Table()        {            dataGridView1.Rows.Clear();            string sql = "select * from Course";            Dao dao = new Dao();            IDataReader dr = dao.read(sql);            while (dr.Read())            {                string a, b, c, d;                a = dr["ID"].ToString();                b = dr["Name"].ToString();                c = dr["Credit"].ToString();                d = dr["Teacher"].ToString();                string[] str = { a, b, c, d};                dataGridView1.Rows.Add(str);            }            dr.Close();//关闭链接        }        private void 添加课程ToolStripMenuItem1_Click(object sender, EventArgs e)        {            Form61 f = new Form61(this);            f.ShowDialog();//添加学生信息的窗体        }        private void 修改课程ToolStripMenuItem_Click(object sender, EventArgs e)        {            string[] str = { dataGridView1.SelectedCells[0].Value.ToString(), dataGridView1.SelectedCells[1].Value.ToString(), dataGridView1.SelectedCells[2].Value.ToString(), dataGridView1.SelectedCells[3].Value.ToString() };            Form61 f = new Form61(str, this);            f.ShowDialog();        }        private void 删除课程ToolStripMenuItem_Click(object sender, EventArgs e)        {            DialogResult r = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);            if (r == DialogResult.OK)            {                string id, name;                id = dataGridView1.SelectedCells[0].Value.ToString();                name = dataGridView1.SelectedCells[1].Value.ToString();                string sql = "delete from Course where ID = '" + id + "'and Name = '" + name + "'";                MessageBox.Show(sql);                Dao dao = new Dao();                dao.Execute(sql);                dataGridView1.Rows.Clear();                Table();            }        }        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)        {            Form5 form5 = new Form5();            form5.Show();//显示这个窗体            this.Hide();//隐藏这个窗体        }    }

public partial class Form61 : Form    {        Form6 form6;        string[] str = new string[4];        public Form61(Form6 f)        {            InitializeComponent();            button3.Visible = false; //插入时 隐藏修改             form6 = f;        }        public Form61(string[] a, Form6 f)        {            InitializeComponent();            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];                    button1.Visible = false;//修改时 隐藏插入            form6 = f ;        }        private void label1_Click(object sender, EventArgs e)        {        }        private void textBox4_TextChanged(object sender, EventArgs e)        {        }        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 Course values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "' )";                MessageBox.Show(sql);                Dao dao = new Dao();                int i = dao.Execute(sql);                if (i > 0)                {                    MessageBox.Show("插入成功");                    textBox1.Text = null;                    textBox2.Text = null;                    textBox3.Text = null;                    textBox4.Text = null;                                 }                form6.Table();                this.Hide();            }        }        private void button3_Click(object sender, EventArgs e)        {            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")            {                MessageBox.Show("修改后有空项,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);            }            else            {                if (textBox1.Text != str[0])                {                    string sql = "update Course set ID = '" + textBox1.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                    Dao dao = new Dao();                    dao.Execute(sql);                    str[0] = textBox1.Text;                }                if (textBox2.Text != str[1])                {                    string sql = "update Course set Name = '" + textBox2.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                    Dao dao = new Dao();                    dao.Execute(sql);                    str[1] = textBox2.Text;                }                if (textBox3.Text != str[2])                {                    string sql = "update Course set Credit = '" + textBox3.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                    Dao dao = new Dao();                    dao.Execute(sql);                    str[2] = textBox3.Text;                }                if (textBox4.Text != str[3])                {                    string sql = "update Course set Teacher = '" + textBox4.Text + "'where ID = '" + str[0] + "' and Name = '" + str[1] + "'";                    Dao dao = new Dao();                    dao.Execute(sql);                    str[3] = textBox4.Text;                }                              form6.Table();                this.Hide();            }        }        private void button2_Click(object sender, EventArgs e)        {            textBox1.Text = null;            textBox2.Text = null;            textBox3.Text = null;            textBox4.Text = null;                    }  }

上述窗体为管理员操作界面,在第一张主操作界面,点击不同的按钮,会跳转至不同的操作界面, 窗体下给出控制代码.管理员权限的用户名及密码皆为admin

4、数据库引用

这是数据库的课程设计 ,怎么能少了数据库尼!!!以下为数据库的链接代码。很重要!!!!

 class Dao    {        public SqlConnection connection()        {            string str = "Data Source=LAPTOP-APLE92MU;Initial Catalog=Demo;Integrated Security=True";         SqlConnection sc = new SqlConnection(str);           sc.Open();//打开数据库链接           return sc;       }       public SqlCommand command(string sql)        {           SqlCommand cmd = new SqlCommand(sql, connection());       return cmd;        }        //用于delete update insert 返回受影响的行数       public int Execute(string sql)       {            return command(sql).ExecuteNonQuery();       }        //用于select 返回SqlDataReader对象,包含select到的数据        public SqlDataReader read(string sql)       {            return command(sql).ExecuteReader();    }   }

这是自己写的一个Dao类自定义函数用于数据库的链接及数据库信息的更新,Data Source 是你数据库服务器名称,Catalog是你数据库的名字,后面的不变即可。

三、系统总结

这个为一个简单的学生选课系统,写的很匆忙,还有一些功能没有实现,缺少一个查询功能,还有一些BUG,此系统供大家参考,如若想要此系统源码附带样本数据库及操作指南,请点击下面链接下载 ,拒绝白嫖,从我做起。

链接: link.

大学生数据库课程设计之学生选课系统(一个超级简单的系统)相关推荐

  1. Java 课程设计_学生选课管理系统(控制台)

    Java 课程设计_学生选课管理系统 需求分析 本数据库的用户主要是学生,通过对用户需求的收集和分析,获得用户对数据库的如下要求. 1.信息需求 学生信息:学号,姓名,性别,专业 登陆信息:账号,密码 ...

  2. 【数据库课程设计】SQLServer数据库课程设计(学生宿舍管理),课设报告+源码+数据库关系图

    数据库课程设计--学生宿舍管理,需要全部源码可以关注私信我,把邮箱发在评论区 前言 一.课题背景和开发环境 1.课题背景 2.开发环境 二.系统功能及示意图 1.系统实现功能 2.功能示意图 2.1学 ...

  3. 数据库课程设计报告-学生学籍管理信息系统

    1.概述 1.1 项目背景 随着我国教育体制改革的深入进行,教育系统得到了前所未有的发展.学生管理正在逐步迈向管理信息现代化.但是我国的学生管理信息化水平还处在初级阶段,主要表现在对学生的学籍信息管理 ...

  4. oracle学生考勤,Oracle数据库课程设计――学生考勤系统的Oracle实现1

    Oracle数据库课程设计――学生考勤系统的Oracle实现1 辽宁工程技术大学 Oracle数据库课程设计报告 学生考勤系统 姓 名: XXXXX 班 级: 计SJ08-1班 学 号: 完成日期: ...

  5. 数据库课程设计个人总结报告

    数据库课程设计个人总结报告 在大二上学期的16周周四,我们小组完成了数据库课程设计,本次课程设计我们小组总共四个人,虽然没有明确谁是组长,但是我感觉分工合作的效率还是挺高的,比预期更快的完成了任务.作 ...

  6. 学生选课系统 数据库课程设计

    数据库课程设计报告 设计题目         学生选课系统 专    业         计算机科学与技术 班    级         计1101 学    号 姓    名        寸利芳 ...

  7. 数据库课程设计----学生信息与选课、成绩评价管理系统

    目录 一.需求分析 4 二.概念设计 5 2.1 概念模型(E-R图) 6 2.2 数据字典 6 三.逻辑结构设计 5 3.1 关系模式 6 3.2 系统结构图 6 四.物理设计 5 4.1 存储安排 ...

  8. 查询学生选修课程管理系统java_JAVA数据库课程设计学生选课管理系统的

    <JAVA数据库课程设计学生选课管理系统的>由会员分享,可在线阅读,更多相关<JAVA数据库课程设计学生选课管理系统的(59页珍藏版)>请在人人文库网上搜索. 1.一.课程设计 ...

  9. 数据库课程设计————学生考试系统

    1.敲代码前的准备工作 1.1准备开发工具 1.1.1 开发工具的说明 本系统利用了xampp 集成环境,利用PHP写后端,html.css.js写前端(其实笔者也是现学现卖) 1.1.2 xampp ...

最新文章

  1. Sass学习笔记 -- 初步了解函数、运算、条件判断及循环
  2. 企业版Java EE正式易主 甲骨文再次放手
  3. 【Jmeter篇】你有Fiddler、Charles抓包,我有Jmeter录制Web和App端
  4. 第 20 次 CSP认证 202009-3 点亮数字人生
  5. 【图像重建】基于matlab GUI霍夫曼图像重建(带面板)【含Matlab源码 1168期】
  6. 模块四:应急预案参考模板
  7. 怎么样域名绑定服务器显示成功,域名备案成功后怎么绑定服务器
  8. Android studio 如何连接手机
  9. Win10强制更新怎么关闭 彻底禁止Windows自动更新方
  10. pptpd搭建过程中 启动成功但不显示ppp0端口
  11. 论文笔记-Understanding Convolution for Semantic Segmentation
  12. Unable to negotiate with XXXX port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
  13. 打击假新闻:谷歌新闻加入“事实调查”标签
  14. 对于网站过度SEO优化会有哪方面的搜索引擎原理
  15. 《安富莱嵌入式周报》第297期:开源生物医学成像系统,可肺部成像,C算法合集500例,突出极致运算速度,数值方法书籍,芯片级激光隔离,3D打印机固件Marlin
  16. 疯狂Java讲义(七)----第二部分
  17. 频繁模式挖掘 Apriori
  18. android模糊查询
  19. Linux虚拟机扩展文件系统
  20. 初识Linux(5)

热门文章

  1. matlab 绘制等高线图,contourf等高线填充,并优化(初学者教程)
  2. linux系统LAMP的实战应用
  3. 什么是 :kail LINUX
  4. 读诗经,赞古人之褰裳-鄭風
  5. C语言写个简单的虚拟机
  6. scrapy源码9 - webclient
  7. Mono-mbe版本编译libmonobdwgc-2.0.so
  8. flash html 通信,JavaScript和Flash的通信
  9. C++学习(六) 常引用、常对象、常对象成员、常成员函数
  10. 微信浏览器中实现音乐自动播放