⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student.cs

📁 学生管理系统的一个文件 我刚刚学不太会
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace CMS
{
    public partial class student : Form
    {
        public student()
        {
            InitializeComponent();
        }

        private void 信息查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = null;
            DataSet ds = new DataSet();
            try
            {
                using (conn = new SqlConnection(@"server=GEM\MIRROR;database=sky;integrated security=true;"))
                {
                    conn.Open();
                    SqlDataAdapter da = new SqlDataAdapter("select * from dbo.sky_student", conn);
                    da.Fill(ds);

                    dataGridView1.DataSource = ds.Tables[0].DefaultView;
                }
                //conn = new SqlConnection("server=localhost;database=zoo;integrated security=true;");
                //conn.Open();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }

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

        private void student_Load(object sender, EventArgs e)
        {
            this.toolStripStatusLabel1.Text = "登录人:" + UserHelper.user;
        }

        private void student_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.Exit();
        }

        private void 成绩查询ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = null;
            DataSet ds = new DataSet();
            try
            {
                using (conn = new SqlConnection(@"server=GEM\MIRROR;database=sky;integrated security=true;"))
                {
                    conn.Open();
                    SqlDataAdapter da = new SqlDataAdapter("select * from dbo.sky_grade", conn);
                    da.Fill(ds);

                    dataGridView1.DataSource = ds.Tables[0].DefaultView;
                }
                //conn = new SqlConnection("server=localhost;database=zoo;integrated security=true;");
                //conn.Open();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }

        private void 密码修改ToolStripMenuItem_Click(object sender, EventArgs e)
        {
           
        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void 个人信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 选修课程ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 课程信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }   
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -