⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 post.aspx.cs

📁 ASP.NET2.0开发一个类似BtoC、CtoC的企业产品信息发布系统。
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
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.OleDb;

public partial class Post : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Session["shop"] == null)
            Response.Redirect("Default.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string fullfilename = this.File1.PostedFile.FileName;
        string filename = fullfilename.Substring(fullfilename.LastIndexOf("\\") + 1);
        string type = fullfilename.Substring(fullfilename.LastIndexOf(".") + 1);
        if (type == "jpg" || type == "bmp" || type == "gif")
        {
            this.File1.PostedFile.SaveAs(Server.MapPath("up") + "\\" + filename);
            this.Image1.ImageUrl = "up/" + filename;
        }
        else
        {
            Response.Write("<script>alert('您选择的文件格式有错!')</script>");
        }  
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        string shop = Request.QueryString["shop"];
        string p1 = Server.HtmlEncode(this.TextBox5.Text);
        string p2 = this.Image1.ImageUrl;
        string p3 = Server.HtmlEncode(this.DXTB1.Text);
        string que = "insert into Ps(p1,p2,p3,c1)values('" + p1 + "','" + p3 + "','" + p2 + "','" + shop + "')";
        if(db.insert(que))
            Response.Write("<script>alert('您已经成功发布新产品!');</script>");
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Response.Write("<script>history.go(-2);</script>");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -