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 zhuanti : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rp1Bind();
                rp2Bind(); 
                rp3Bind();
                rp4Bind(); 
                rp5Bind();


            }

        }

        //
        public void rp1Bind()
        {
            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 top 6 * from news where BigClassId=21 order by addtime desc";

            //创建数据库命令
            OleDbCommand mycmd = new OleDbCommand(sql, myconn);
            OleDbDataReader result = mycmd.ExecuteReader();

            rp1.DataSource = result;
            rp1.DataBind();
            myconn.Close();

        }



        public void rp2Bind()
        {
            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 top 6 * from news where BigClassId=19 order by addtime desc";

            //创建数据库命令
            OleDbCommand mycmd = new OleDbCommand(sql, myconn);
            OleDbDataReader result = mycmd.ExecuteReader();

            rp2.DataSource = result;
            rp2.DataBind();
            myconn.Close();

        }
        public void rp3Bind()
        {
            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 top 6 * from news where BigClassId=20 order by addtime desc";

            //创建数据库命令
            OleDbCommand mycmd = new OleDbCommand(sql, myconn);
            OleDbDataReader result = mycmd.ExecuteReader();

            rp3.DataSource = result;
            rp3.DataBind();
            myconn.Close();

        }
        public void rp4Bind()
        {
            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 top 6 * from news where BigClassId=21 order by addtime desc";

            //创建数据库命令
            OleDbCommand mycmd = new OleDbCommand(sql, myconn);
            OleDbDataReader result = mycmd.ExecuteReader();

            rp4.DataSource = result;
            rp4.DataBind();
            myconn.Close();

        }
        public void rp5Bind()
        {
            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 top 6 * from news where BigClassId=22 order by addtime desc";

            //创建数据库命令
            OleDbCommand mycmd = new OleDbCommand(sql, myconn);
            OleDbDataReader result = mycmd.ExecuteReader();

            rp5.DataSource = result;
            rp5.DataBind();
            myconn.Close();

        }
    }
}
