EditFacility.aspx.cs

(开头部分) 2KB

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

using MyWeb.DBUtility;
using MyWeb.WebUtility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;


namespace MyWeb
{
    public partial class EditFacility : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DBHelper db = new DBHelper();
                string sql = "select * from Facility_Tbl where del=0 and id='" + Request["id"].ToString() + "'";
                DataSet ds = db.Query(sql);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    TextBox1.Text = ds.Tables[0].Rows[0]["title"].ToString();
                }
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DBHelper db = new DBHelper();
            //声明提示类
            WebHelper wb = new WebHelper();
            //设置文件的保存路径
            string savePath = Server.MapPath("~/FacilityPic/");
            string Url = "";
            string Name = "";
            //判断是否有文件上传
            if (FileUpload1.HasFile)
            {
                //判断是否存在这个文件夹
                if (!System.IO.Directory.Exists(savePath))
                {
                    //如果没有这个文件夹,就创建一个
                    System.IO.Directory.CreateDirectory(savePath);
                }
                Url = "FacilityPic/" + FileUpload1.FileName + "";
                Name = FileUpload1.FileName;
                savePath = savePath + "\\" + FileUpload1.FileName;
                //文件保存
                FileUpload1.SaveAs(savePath);
                try
                {
                    //string sql = "insert into Dynamic_Tbl values('" + Url + "','" + TextBox1.Text + "','" + TextBox2.Text + "',getdate(),0)";
                    string sql = "update Facility_Tbl set FacilityUrl='" + Url + "',title='" + TextBox1.Text + "' where id='" + Request["id"].ToString() + "'";
                    int renum = db.ExecuteSql(sql);
                    if (renum == 1)
                    {
                        //成功
                        wb.Alert("修改求购信息成功!", "FacilityManage.aspx");
后面还有 26 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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