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

📄 class_fresh.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_class_fresh : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["shang_admin"] == null)
        {
            Response.Redirect("get_your_passport.aspx");
        }
        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");

        //开始刷新新闻
        SqlConnection con3 = db.CreateConnection();
        con3.Open();
        string strsql3 = "select * from news where bigclassname='"+Request.QueryString["bigclassname"]+"'";
        SqlDataAdapter ad3 = new SqlDataAdapter(strsql3, con3);
        DataSet ds3 = new DataSet();
        ad3.Fill(ds3, "cc");
        for (int i = 0; i < ad3.Fill(ds3, "cc"); i++)
        {
            template = ds1.Tables["bb"].Rows[0]["example"].ToString();
            template = Regex.Replace(template, "E_title", ds3.Tables["cc"].Rows[i]["title"].ToString());
            template = Regex.Replace(template, "E_now", ds3.Tables["cc"].Rows[i]["time"].ToString());
            template = Regex.Replace(template, "E_fenlei", ds3.Tables["cc"].Rows[i]["bigclassname"].ToString());
            template = Regex.Replace(template, "E_content", ds3.Tables["cc"].Rows[i]["content"].ToString());
            template = Regex.Replace(template, "E_num", ds3.Tables["cc"].Rows[i]["bh"].ToString());
            StreamWriter sw = File.CreateText(Server.MapPath("../articls/" + ds3.Tables["cc"].Rows[i]["bigclassname"].ToString() + "/" + ds3.Tables["cc"].Rows[i]["bh"].ToString() + ".aspx"));
            sw.Write(template);
            sw.Close();
        }
        con1.Close();
        con3.Close();
        Response.Redirect("template_manage.aspx?action=操作已成功");
    }
}

⌨️ 快捷键说明

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