Manage/editproduct.aspx.cs
(完整代码) 1KBusing 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;
using LYF.SqlHelper;
public partial class Manage_editproduct : System.Web.UI.Page
{
private SqlHelper shp = new SqlHelper("XS");
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Uname"] == null || Session["Uname"].ToString() == "")
{
Response.Write("<script>parent.location.href='login.aspx'</script>");
}
if (!IsPostBack)
{
LoadBind();
}
}
private void LoadBind()
{
string id = Request.QueryString["id"];
string selsql = "select productname,price,shuliang from XS_Products where id='" + id + "'";
using (SqlDataReader dr = shp.ExecuteReader(selsql))
{
if (dr.Read())
{
this.pname.InnerText = dr["productname"].ToString();
this.price.Value = Double.Parse(dr["price"].ToString()).ToString("0.00");
this.pcount.Value = dr["shuliang"].ToString();
}
}
shp.CloseDB();
}
/// <summary>
/// 修改事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void SureBT_Click(object sender, EventArgs e)
{
string updatesql = "update XS_Products set price=" + this.price.Value + ",shuliang=" + this.pcount.Value + " where id=" + Request.QueryString["id"] + "";
shp.ExecuteNonQuery(updatesql);
Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>parent.closeLayer('editproduct');</script>");
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。