Ejemplo n.º 1
0
    /// <summary>
    /// 重写application的内容
    /// </summary>
    public static void reWriteApplication()
    {
        ListItem     li;
        BulletedList fulllist = new BulletedList();

        newClasses.superConn scnn = new newClasses.superConn("DATA.MDB");

        scnn.open();
        string _sql = "SELECT * FROM T_SUBMENU WHERE MENU_ENABLE=TRUE ORDER BY MENU_CLASSID,MENU_ORDER DESC";

        System.Data.OleDb.OleDbDataReader dr = scnn.GetDataReader(_sql);
        while (dr.Read())
        {
            li       = new ListItem();
            li.Text  = dr["menu_ttl"].ToString();
            li.Value = dr["menu_url"].ToString();
            li.Attributes.Add("classid", dr["menu_classid"].ToString());//增加一个classid属性
            fulllist.Items.Add(li);
        }

        scnn.close();

        HttpContext.Current.Application.Lock();
        HttpContext.Current.Application["submenu"] = fulllist;
        HttpContext.Current.Application.UnLock();
    }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据新闻的ID,从数据库获取新闻和相关信息;
        /// </summary>
        /// <param name="newsid"></param>
        public superNewsItem(int newsid)
        {
            superConn scnn = new superConn("DATA.mdb");

            scnn.open();
            string          _sql = "SELECT T_NEWS.*, T_imgMng.img_url, List_newsClass.nc_ttl FROM List_newsClass INNER JOIN (T_imgMng INNER JOIN T_NEWS ON T_imgMng.img_id = T_NEWS.news_imgid) ON List_newsClass.nc_id = T_NEWS.news_ncid WHERE news_id=" + newsid;
            OleDbDataReader dr   = scnn.GetDataReader(_sql);

            if (dr.Read())
            {
                news_id      = int.Parse(dr["news_id"].ToString());
                news_ncid    = int.Parse(dr["news_ncid"].ToString());
                nc_ttl       = dr["nc_ttl"].ToString();
                news_ttl     = dr["news_ttl"].ToString();
                news_guide   = dr["news_guide"].ToString();
                news_date    = (DateTime)dr["news_date"];
                news_imgid   = int.Parse(dr["news_imgid"].ToString());
                img_url      = dr["img_url"].ToString();
                news_content = dr["news_content"].ToString();
                news_order   = int.Parse(dr["news_order"] is DBNull ? "0" : dr["new_order"].ToString());
                news_enable  = (Boolean)dr["news_enable"];
                news_home    = (Boolean)dr["news_home"];
            }
            scnn.close();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 以类别ID来设置新闻所属类别
        /// </summary>
        /// <param name="classID"></param>
        public void setClass(int classID)
        {
            superConn scnn = new superConn("DATA.mdb");

            scnn.open();
            string          _sql = "SELECT * FROM List_newsClass WHERE nc_id=" + classID;
            OleDbDataReader dr   = scnn.GetDataReader(_sql);

            if (dr.Read())
            {
                news_ncid = int.Parse(dr["nc_id"].ToString());
                nc_ttl    = dr["nc_ttl"].ToString();
            }
            scnn.close();
        }
Ejemplo n.º 4
0
        //2
        public superFile(int _id)
        {
            _fileName = _fileTitle = "";
            superConn sconn = new superConn("fileMNG.mdb");

            sconn.open();
            string          _sql = "SELECT * FROM T_FILES WHERE f_id=" + _id;
            OleDbDataReader dr   = sconn.GetDataReader(_sql);

            if (dr.Read())
            {
                _fileTitle = dr["f_title"].ToString();
                _fileName  = dr["f_name"].ToString();
            }
            sconn.close();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 通过ID从数据库获取对应ID的文章
        /// </summary>
        /// <param name="artID"></param>
        public superArtReader(string artID)
        {
            ArtID      = artID;
            ArtTitle   = "";
            ArtContent = "";

            superConn scnn = new superConn("DATA.mdb");

            scnn.open();
            string          _sql = "select * from T_article WHERE art_id=" + artID;
            OleDbDataReader dr   = scnn.GetDataReader(_sql);

            if (dr.Read())
            {
                ArtTitle   = dr["art_ttl"].ToString();
                ArtContent = dr["art_content"].ToString();
            }
            scnn.close();
        }