📄 news_content.aspx.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;
public partial class News_Content : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int newsId = Convert.ToInt32(Request.QueryString["NewsId"]);
string sql = "select A.*,B.[ClassId],B.[ClassName] from [NcNews] As A Left Join [NcClass] B On A.[NewsClassId]=B.[ClassId] where A.[NewsId]=" + newsId;
WebConfig.CreateCon();
OleDbDataAdapter da = new OleDbDataAdapter(sql, WebConfig.con);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
this.Head1.Title = ds.Tables[0].Rows[0]["NewsTitle"].ToString() + "的详细信息--" + Application["webName"].ToString();
Label1.Text = dt.Rows[0]["NewsTitle"].ToString();
Label2.Text = dt.Rows[0]["NewsDate"].ToString();
Label3.Text = dt.Rows[0]["NewsContent"].ToString();
Label4.Text = "<a class=\"cBlack\" href=\"News_List_" + dt.Rows[0]["classId"].ToString() + ".aspx\">" + dt.Rows[0]["CLassName"].ToString() + "</a>";
if (dt.Rows[0]["NewsPic"] != null)
{
if (dt.Rows[0]["NewsPic"].ToString() != "")
{
Label5.Text = "<img src=upload/" + dt.Rows[0]["NewsPic"].ToString() + " /><br><br>";
}
}
ds.Dispose();
da.Dispose();
WebConfig.CloseCon();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -