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

📄 xiu.aspx.cs

📁 一个简单的新闻发布系统,入门最好先学这个
💻 CS
字号:
using System;
using System.Data;
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;
using System.Data.OleDb;

//该源码下载自www.51aspx.com(51aspx.com)

public partial class xiu : System.Web.UI.Page
{
    public DataRow dr;
    public String newsid;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            newsid = Request.Params["id"];
           // Response.Write("newsid==="+newsid);
            string strConnnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
            strConnnection += Server.MapPath(".\\App_Data\\news.mdb");
            OleDbConnection myconn = new OleDbConnection(strConnnection);

            OleDbDataAdapter odr = new OleDbDataAdapter("select * from contents where id="+newsid,myconn);
            DataSet ds = new DataSet();
            odr.Fill(ds,"contents");
            dr = ds.Tables["contents"].Rows[0];
            txtBiaoti.Text = dr["biaoti"].ToString();
            txtNeirong.Text = dr["neirong"].ToString();
            txtZuozhe.Text = dr["zuozhe"].ToString();
        
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        newsid = Request.Params["id"];
        string strConnnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
        strConnnection += Server.MapPath(".\\App_Data\\news.mdb");
        OleDbConnection myconn = new OleDbConnection(strConnnection);
        myconn.Open();
        OleDbCommand updatecmd = new OleDbCommand("update contents set biaoti='"+txtBiaoti.Text+"',neirong='"+txtNeirong.Text+"',zuozhe='"+txtZuozhe.Text+"' where id="+newsid,myconn);
        updatecmd.ExecuteNonQuery();
        myconn.Close();
        Response.Redirect("delnews.aspx");
    }
}

⌨️ 快捷键说明

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