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;

namespace mdEngergy
{
    public partial class newsView : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                int newsid = Convert.ToInt32(Request.QueryString["id"].ToString());

                string strConnection = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath("DB_51aspx\\Data.mdb");
                //创建数据库连接对象
                OleDbConnection myconn = new OleDbConnection(strConnection);
                //打开数据库连接
                myconn.Open();
                string sql = "select A.Title,A.Content,A.AddTime,A.Author,A.ReadCishu, B.BigClassName from News A ,BigClass B Where B.BigClassID = A.BigClassID And A.ID =" + newsid;

                //创建数据库命令
                OleDbCommand mycmd = new OleDbCommand(sql, myconn);
                OleDbDataReader dr = mycmd.ExecuteReader();
                if (dr.Read())
                {
                 //   lbl_class.Text = dr["BigClassName"].ToString();
                    lbTitle.Text = dr["Title"].ToString();
                    lbContent.Text = dr["Content"].ToString();
                    lbAuthor.Text = dr["Author"].ToString();
                    lbDate.Text = dr["AddTime"].ToString();
                //    lbl_info.Text = "作者：" + dr["Author"].ToString() + "     时间：" + dr["AddTime"].ToString() + "阅读：" + dr["ReadCishu"].ToString() + "次";
                }
                //int n = Convert.ToInt32(dr["ReadCishu"].ToString()) + 1;
                myconn.Close();
            }

        }
    }
}
