📄 breakbookquery.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 BreakBookQuery : Form
{
public BreakBookQuery()
{
InitializeComponent();
}
private void BreakBookQuery_Load(object sender, EventArgs e)
{
comboBox1.Text = "所有原因";
}
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedItem.ToString() == "所有原因")
{
string selectstr = "select Bookid as 图书编号,Bookname as 图书名称,Readerid as 读者编号,readerxi as 系别,Readerbanji as 班级,Bookwriter as 作者,Bookpublish as 出版社,Bookpubdate as 出版时间,Bookprice as 价格,Booksort as 类别,Breakwhy as 报损原因,Addpeople as 添加人,Addtime as 添加时间 from Breakbook ";
DataSet ds = new DataSet();
ds = Operator.SelectSql(selectstr);
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
if (comboBox1.SelectedItem.ToString() == "资料损坏")
{
string selectstr = "select Bookid as 图书编号,Bookname as 图书名称,Readerid as 读者编号,readerxi as 系别,Readerbanji as 班级,Bookwriter as 作者,Bookpublish as 出版社,Bookpubdate as 出版时间,Bookprice as 价格,Booksort as 类别,Breakwhy as 报损原因,Addpeople as 添加人,Addtime as 添加时间 from Breakbook where Breakwhy='资料损坏'";
DataSet ds = new DataSet();
ds = Operator.SelectSql(selectstr);
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
if (comboBox1.SelectedItem.ToString() == "资料丢失")
{
string selectstr = "select Bookid as 图书编号,Bookname as 图书名称,Readerid as 读者编号,readerxi as 系别,Readerbanji as 班级,Bookwriter as 作者,Bookpublish as 出版社,Bookpubdate as 出版时间,Bookprice as 价格,Booksort as 类别,Breakwhy as 报损原因,Addpeople as 添加人,Addtime as 添加时间 from Breakbook where Breakwhy='资料丢失'";
DataSet ds = new DataSet();
ds = Operator.SelectSql(selectstr);
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
if (comboBox1.SelectedItem.ToString() == "其它原因")
{
string selectstr = "select Bookid as 图书编号,Bookname as 图书名称,Readerid as 读者编号,readerxi as 系别,Readerbanji as 班级,Bookwriter as 作者,Bookpublish as 出版社,Bookpubdate as 出版时间,Bookprice as 价格,Booksort as 类别,Breakwhy as 报损原因,Addpeople as 添加人,Addtime as 添加时间 from Breakbook where Breakwhy <> '资料损坏' and Breakwhy <> '资料丢失'";
DataSet ds = new DataSet();
ds = Operator.SelectSql(selectstr);
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
string selectstr = "select Bookid as 图书编号,Bookname as 图书名称,Readerid as 读者编号,readerxi as 系别,Readerbanji as 班级,Bookwriter as 作者,Bookpublish as 出版社,Bookpubdate as 出版时间,Bookprice as 价格,Booksort as 类别,Breakwhy as 报损原因,Addpeople as 添加人,Addtime as 添加时间 from Breakbook where Readerid like '"+textBox1.Text+"%'";
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 + -