AddFacility.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 AddFacility : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        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
                {
                    //新增资源表的sql
                    string sql = "insert into Facility_Tbl values('"+Session["id"].ToString()+"','" + Url + "','" + TextBox1.Text + "',getdate(),0)";
                    int renum = db.ExecuteSql(sql);
                    if (renum == 1)
                    {
                        //成功
                        wb.Alert("添加求购信息成功!", "AddFacility.aspx");
                    }
                    else
                    {
                        //失败
                        wb.Alert("添加求购信息失败!", "AddFacility.aspx");
                    }
                }
                catch
                {
后面还有 17 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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