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

📄 图书盘点.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 图书馆管理系统
{
    /// <summary>
    /// 打印图书报表
    /// 可以通过给定的范围进行查询
    /// </summary>
    public partial class 图书盘点 : Form
    {
        public 图书盘点()
        {
            InitializeComponent();
        }

        private void 图书盘点_Load(object sender, EventArgs e)
        {
           // sqlDataAdapter1.Fill(dataSet31, "图书信息");
            textvisable(false);

        }
//-------------------------------控制是否可见------
        private void textvisable(bool A)
        {
            label3.Visible = A;
            label4.Visible = A;
            label5.Visible=A;
            textBox2.Visible=A;
        }
//------------------------------------------------------查询-----------------------------------
        private void button1_Click(object sender, EventArgs e)
        {
            sqlConnection1.Open();
            string str = "";
            switch (comboBox1.SelectedIndex)
            {
                case 0:
                    str = "select * from 图书信息";
                    break;
                case 1:case 2:case 6:case 8:case 9:case 10:
                    str = "select * from 图书信息 where " + comboBox1.Text + " between '"+textBox1.Text+"' and '"+textBox2.Text+"'";
                    break;
                case 5:
                    str = "select * from 图书信息 where  CONVERT(int," + comboBox1.Text + ")  between '" + textBox1.Text + "' and '" + textBox2.Text + "'";
                    break;
                case 3:case 4:case 7:case 11:
                    str = "select * from 图书信息 where " + comboBox1.Text + "='"+textBox1.Text+"'";
                    break;
                default:
                    str = "select * from 图书信息";
                    break;
            }
            SqlDataAdapter myda = new SqlDataAdapter(str, sqlConnection1);
            dataSet31.Clear();
            myda.Fill(dataSet31, "图书信息");
            sqlConnection1.Close();

        }
        //----------------comboBox1事件--------------------
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text == "条形码" || comboBox1.Text == "编号" || comboBox1.Text == "价格" || comboBox1.Text == "页码" || comboBox1.Text == "现存量" || comboBox1.Text == "库存量" || comboBox1.Text == "借出次数")
            {
                textvisable(true);
            }
            else
            {
                textvisable(false);
            }
        }
//--------------------------------打印报表------------------------------------------
        private void button2_Click(object sender, EventArgs e)
        {
            CrystalReport1 rep = new CrystalReport1();
            rep.SetDataSource(dataSet31.Tables[0]);
            报表 fb = new 报表();
            fb.Show();
            fb.crystalReportViewer1.ReportSource = rep;
        }
    }
}

⌨️ 快捷键说明

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