Admin/FenLei.aspx.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Admin_FenLei : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["ID"] != null)
            {
                InitData();
            }
        }

    }
    protected void InitData()
    {
        string id = Request["ID"].ToString();
        try
        {
            string sql = "select * from tb_GoodsType where TypeID=" + id;
            DataSet ds = DBHelper.GetDataSet(sql);
            if (ds.Tables[0].Rows.Count > 0)
            {
                this.TextBox1.Text = ds.Tables[0].Rows[0]["TypeName"].ToString();
            }
        }
        catch
        {
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql;
        if (Request["ID"] != null)
        {
            string id =Request["ID"].ToString();
            sql = "update tb_GoodsType set TypeName='" + TextBox1.Text + "' where TypeID=" + id;
            bool b = DBHelper.ExecSql(sql);
            if (b)
            {
                Response.Write("<script>javascript:alert('操作成功');</script>");
            }
            else
            {
                Response.Write("<script>javascript:alert('系统错误,您没有设置好数据库的连接!或您输入了一些非法字符!');</script>");
            }
        }
        else
        {
            sql = "insert into tb_GoodsType(TypeName) values('" + this.TextBox1.Text.Trim() + "')";
            bool b = DBHelper.ExecSql(sql);
            if (b)
后面还有 14 行代码,购买后查看完整代码

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

AI 解读 AI

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

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