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

📄 userinfquery.cs

📁 这是一个图书馆管理用的简化系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BMS
{
    public partial class UserInfQuery : Form
    {
        public UserInfQuery()
        {
            InitializeComponent();
        }

        private void UserInfQuery_Load(object sender, EventArgs e)
        {
            comboBox1.Text = "管理员信息";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem.ToString() == "管理员信息")
            {
                string selectstr = "select Ad_id as 管理员编号,Ad_sex as 性别,Ad_name as 姓名,Ad_degree as 身份证号,Ad_address as 联系地址,Ad_phone as 联系电话,Ad_people as 添加人,Ad_date as 添加时间 from Admin";
                DataSet ds = new DataSet();
                ds = Operator.SelectSql(selectstr);
                this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            if (comboBox1.SelectedItem.ToString() == "操作员信息")
            {
                string selectstr = "select id as 操作员编号,sex as 性别,name as 姓名,age as 年龄,school as 学历,degreenum as 身份证号,address as 联系地址,phone as 联系电话,addpeople as 添加人,addate as 添加时间 from Operate";
                DataSet ds = new DataSet();
                ds = Operator.SelectSql(selectstr);
                this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            string str = comboBox1.SelectedItem.ToString();
            if (str == "管理员信息")
            {
                string selectstr = "select Ad_id as 管理员编号,Ad_sex as 性别,Ad_name as 姓名,Ad_degree as 身份证号,Ad_address as 联系地址,Ad_phone as 联系电话,Ad_people as 添加人,Ad_date as 添加时间 from Admin where Ad_name like '" + textBox1.Text.ToString() + "'";
                DataSet ds = new DataSet();
                ds = Operator.SelectSql(selectstr);
                this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else
            {
                string selectstr = "select id as 操作员编号,sex as 性别,name as 姓名,age as 年龄,school as 学历,degreenum as 身份证号,address as 联系地址,phone as 联系电话,addpeople as 添加人,addate as 添加时间 from Operate where name like '" + textBox1.Text.ToString() + "'";
                DataSet ds = new DataSet();
                ds = Operator.SelectSql(selectstr);
                this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
        }
    }
}

⌨️ 快捷键说明

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