📄 bookinforquery.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace BooksM.InforQuery
{
public partial class BookInforQuery : Form
{
public BookInforQuery()
{
InitializeComponent();
}
private void BookInforQuery_Load(object sender, EventArgs e)
{
MyClass.ConnData myConnData = new BooksM.MyClass.ConnData();
DataSet myDataSet = new DataSet();
string str = "select * from BookIndex ";
try
{
myDataSet = myConnData.MyDataSet(str);
this.comboBox1.DataSource = myDataSet.Tables[0];
this.comboBox1.DisplayMember = "CategoryDes";
this.comboBox1.ValueMember = "BookCategoryID";
}
catch
{
MessageBox.Show("图书暂末分类!");
comboBox1.Focus();
}
textBox4.Text = DateTime.Now.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
string BookCategoryID = comboBox1.SelectedValue.ToString();
MyClass.ConnData myConnData = new BooksM.MyClass.ConnData();
string temp = "select * from BookCardInfor where "
+ "BookCategoryID like '"
+ BookCategoryID + "%' and BookID like '%"
+ textBox1.Text.ToString().Trim() + "%' and AuthorName like '%"
+ textBox2.Text.ToString().Trim() + "%' and Publisher like '%"
+ textBox3.Text.ToString().Trim() + "%' and CONVERT(varchar(100),PublicationDate,120) like '%"
+ textBox4.Text.ToString().Trim() + "%'";
myConnData.ShowDataGrid(ref temp, ref dataGridView1);
}
catch
{
MessageBox.Show("查询失败!");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -