49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Data.OleDb;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.UI;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
|
|||
|
|
public partial class Main_article : System.Web.UI.Page
|
|||
|
|
{
|
|||
|
|
protected string title = "";
|
|||
|
|
protected string author = "";
|
|||
|
|
protected string hits = "";
|
|||
|
|
protected string updatetime = "";
|
|||
|
|
protected string content="";
|
|||
|
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!Page.IsPostBack)
|
|||
|
|
{
|
|||
|
|
string articleid = Request.QueryString["articleid"];
|
|||
|
|
if (string.IsNullOrEmpty(articleid))
|
|||
|
|
{
|
|||
|
|
Response.Write("无效参数");
|
|||
|
|
Response.End();
|
|||
|
|
}
|
|||
|
|
var dt = new DataTable();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var conn = new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings["AccessConnectionString"]);
|
|||
|
|
var adt = new OleDbDataAdapter("Select * from pe_article where articleid=" + articleid, conn);
|
|||
|
|
adt.Fill(dt);
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
Response.Write("<h4>无法获取网站数据</h4>");
|
|||
|
|
Response.End();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
title = dt.Rows[0]["title"].ToString();
|
|||
|
|
author = dt.Rows[0]["author"].ToString();
|
|||
|
|
hits = dt.Rows[0]["hits"].ToString();
|
|||
|
|
updatetime = dt.Rows[0]["updatetime"].ToString().Split(' ')[0];
|
|||
|
|
content = dt.Rows[0]["content"].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|