📄 viewbook.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 BookShop;
using System.Data.SqlClient;
public partial class ViewBook : System.Web.UI.Page
{
private int nBookID = -1;
private int nCategoryID = -1;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Params["CategoryID"] != null)
{
nCategoryID = Int32.Parse(Request.Params["CategoryID"].ToString());
}
if (Request.Params["BookID"] != null)
{
nBookID = Int32.Parse(Request.Params["BookID"].ToString());
}
if (!Page.IsPostBack)
{
if (nBookID > -1)
{
///显示被修改书籍的数据
BindBookData(nBookID);
}
}
}
private void BindBookData(int nBookID)
{
///从数据库获取数据
Book book = new Book();
SqlDataReader recb = book.GetSingleBook(nBookID);
///显示数据
if (recb.Read())
{
Name.Text = recb["Name"].ToString();
Desn.Text = recb["Desn"].ToString();
Author.Text = recb["Author"].ToString();
Publish.Text = recb["Publish"].ToString();
PublishDate.Text = recb["PublishDate"].ToString();
Foreword.Text = recb["Foreword"].ToString();
List.Text = recb["List"].ToString();
OutLine.Text = recb["OutLine"].ToString();
BuyInDate.Text = recb["BuyInDate"].ToString();
Price.Text = recb["Price"].ToString();
TotalNum.Text = recb["TotalNum"].ToString();
StoreNum.Text = recb["StoreNum"].ToString();
SellOrder.Text = recb["SellOrder"].ToString();
Attribute1.Text = recb["Attribute1"].ToString();
Attribute2.Text = recb["Attribute2"].ToString();
Attribute3.Text = recb["Attribute3"].ToString();
Attribute4.Text = recb["Attribute4"].ToString();
Attribute5.Text = recb["Attribute5"].ToString();
Remark.Text = recb["Remark"].ToString();
}
///关闭数据源
recb.Close();
}
protected void ReturnBtn_Click(object sender,EventArgs e)
{
///返回管理页面
Response.Redirect("~/DesktopModules/Book/MainManage.aspx"
+ "?CategoryID=" + nCategoryID.ToString());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -