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

📄 downloads_add.aspx.cs

📁 尚都shangdu新闻后台管理程序,可做各种网站新闻发布
💻 CS
字号:
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Data;
using System.Runtime;
using System.Data.SqlClient;
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;

public partial class admin_downloads_add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["shang_admin"] == null)
        {
            Response.Redirect("get_your_passport.aspx");
        }
        DateTime timenow = DateTime.Now;
        TextBox5.Text = timenow.ToString();
        this.TextBox9.Style.Add("display", "none");
        this.eWebEditor1.Attributes.Add("src", "editor/ewebeditor.htm?id=TextBox9&style=gray");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text == "")
        {
            Response.Redirect("downloads_manage.aspx");
        }
        else
        {
            try
            {
                SqlConnection con = db.CreateConnection();
                con.Open();
                string newid;
                string strsql = "insert into downloads (name,pic,infor,banquan,kaifa,time,leixing,admin,place,bigclassname,tag,xiangguan,hits) values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox9.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + Convert.ToDateTime(TextBox5.Text) + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + DropDownList1.Text + "','tag','xiangguan','0') SELECT  @@IDENTITY  as  'bh'";
                SqlCommand cmd = new SqlCommand(strsql, con);
                newid = cmd.ExecuteScalar().ToString();
                con.Close();


                string template;
                SqlConnection con1 = db.CreateConnection();
                con1.Open();
                string strsql1 = "select * from example";
                SqlDataAdapter ad1 = new SqlDataAdapter(strsql1, con1);
                DataSet ds1 = new DataSet();
                ad1.Fill(ds1, "bb");
                template = ds1.Tables["bb"].Rows[1]["example"].ToString();
                template = Regex.Replace(template, "E_name", TextBox1.Text);
                template = Regex.Replace(template, "E_pic", TextBox2.Text);
                template = Regex.Replace(template, "E_infor", TextBox9.Text);
                template = Regex.Replace(template, "E_bigclassname", DropDownList1.Text);
                template = Regex.Replace(template, "E_place", TextBox8.Text);
                template = Regex.Replace(template, "E_now", TextBox5.Text);
                template = Regex.Replace(template, "E_num", newid);
                StreamWriter sw = File.CreateText(Server.MapPath("../downloads/" + DropDownList1.Text + "/" + newid + ".aspx"));
                sw.Write(template);
                sw.Close();
                con1.Close();

                Response.Redirect("downloads_manage.aspx?bigclassname=" + DropDownList1.Text + "");
            }
            catch (Exception ee)
            {
                Response.Write("Some thing Error happend->DOWNLOADS SYSTEM INSERT ERROR:you can enter <a href='http://www.shangducms.cn'>shangducms.cn</a> to find more information." + ee.ToString());
            }
        }
    }
}

⌨️ 快捷键说明

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