📄 queryreaderhistoryform.aspx.cs
字号:
//文件名:QueryReaderHistoryForm.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class QueryManage_QueryReaderHistoryForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("D9") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
private static string MySQL = "";
private static string MyDate = "";
protected void Button1_Click(object sender, EventArgs e)
{//查询读者借史
DataTable MyQueryTable = new System.Data.DataTable();
DataTable MyReaderTable = new System.Data.DataTable();
SqlConnection MyConnection = new SqlConnection();
MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings["MyBooksDBConnectionString"].ConnectionString;
MyConnection.Open();
MySQL = "Select 读者姓名 From 读者信息 WHERE 读者编号= '" + this.TextBox3.Text + "'";
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyReaderTable);
if (MyReaderTable.Rows.Count < 1)
{
this.TextBox4.Text = "";
return;
}
else
{
this.TextBox4.Text = MyReaderTable.Rows[0][0].ToString();
MySQL = "SELECT 图书书号,图书书名,借出日期,应还日期,归还日期,遗失图书,补充说明 FROM 借阅管理 WHERE (借出日期 BETWEEN '" + this.TextBox1.Text + "' AND '" + this.TextBox2.Text +
"') AND (读者编号='" + this.TextBox3.Text + "')";
MyDate = "读者姓名:" + MyReaderTable.Rows[0][0].ToString() +" 开始日期:" + this.TextBox1.Text + " 结束日期:" + this.TextBox2.Text;
MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyQueryTable);
}
this.GridView1.DataSource = MyQueryTable;
this.GridView1.DataBind();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
public string MyPrintSQL
{//设置要传递到打印页的数据
get
{
return MySQL;
}
}
public String MyPrintDate
{//设置要传递到打印页的数据
get
{
return MyDate;
}
}
protected void Button2_Click(object sender, EventArgs e)
{//打印读者借史
Server.Transfer("~/QueryManage/QueryReaderHistoryPrint.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -