book/EditBook.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Data.SqlClient;

public partial class book_EditBook : System.Web.UI.Page
{
    DataBaseHelper dbHelper = new DataBaseHelper();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string bookid = Request.QueryString["BOOKID"];
                this.hdfBookID.Value = bookid;
            }
            catch
            {
                Response.Redirect("BookSelect.aspx");
            }

            DataRow drData;
            drData = this.GetBook(this.hdfBookID.Value);

            if (drData == null)
            {
                return;
            }

            this.txtName.Text = drData["bookname"].ToString();
            this.txtAuthor.Text = drData["author"].ToString();
            this.txtISDN.Text = drData["isdn"].ToString();
            this.txtPrice.Text = drData["price"].ToString();
            this.txtPublisher.Text = drData["publisher"].ToString();
            this.txtDescription.Text = drData["description"].ToString();
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string sql = " update book set BOOKNAME =@NAME ,AUTHOR=@AUTHOR,PUBLISHER=@PUBLISHER,PRICE=@PRICE,ISDN=@ISDN,DESCRIPTION=@DESCRIPTION  where BOOKID=@BOOKID";

        SqlParameter[] parameters = new SqlParameter[7];

        SqlParameter name = new SqlParameter("@NAME", SqlDbType.VarChar);
        name.Value = this.txtName.Text;
        parameters[0] = name;


        SqlParameter author = new SqlParameter("@AUTHOR", SqlDbType.VarChar);
        author.Value = this.txtAuthor.Text.Trim();
        parameters[1] = author;

        SqlParameter publisher = new SqlParameter("@PUBLISHER", SqlDbType.VarChar);
        publisher.Value = this.txtPublisher.Text.Trim();
        parameters[2] = publisher;

        SqlParameter price = new SqlParameter("@PRICE", SqlDbType.Decimal);
        price.Value = double.Parse(this.txtPrice.Text.Trim());
        parameters[3] = price;
后面还有 55 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。