国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

ArrayList應用

2024-07-21 02:20:22
字體:
來源:轉載
供稿:網友
注冊會員,創建你的web開發資料庫,        /// <summary>
        /// 取的貼子列表
        /// </summary>
        /// <remarks>
        /// 返回一個forum數組
        /// </remarks>
        public arraylist getforumlist()
        {
            //定義一個forum數組做為返回值
            arraylist arrforumlist =new arraylist() ;

            //從數據庫中讀取版面列表
            myclass.util.myconnection myconn = new myclass.util.myconnection("bbs") ;
            sqlcommand mycommand = new sqlcommand() ;
            mycommand.activeconnection = myconn ;
            mycommand.commandtext = "up_getforumlist" ;    //調用存儲過程
            mycommand.commandtype = commandtype.storedprocedure ;

            try
            {
                myconn.open() ;
                sqldatareader myreader ;
                mycommand.execute(out myreader) ;

                for (int i = 0 ; myreader.read() ; i++)
                {
                    myclass.bbs.forum objitem = new myclass.bbs.forum() ;
                    objitem.id = myreader["id"].tostring().toint32() ;
                    objitem.name = myreader["title"].tostring() ;
                    objitem.description = myreader["description"].tostring() ;
                    objitem.topiccount = myreader["topiccount"].tostring().toint32() ;
                    objitem.layer = myreader["layer"].tostring().toint32() ;
                    objitem.fatherid = myreader["fatherid"].tostring().toint32() ;
                    objitem.master = new bbsuser(myreader["userid"].tostring().toint32() ,
                        myreader["username"].tostring() , myreader["email"].tostring() ,
                        myreader["homepage"].tostring() , myreader["signature"].tostring()) ;
                    arrforumlist.add(objitem) ;
                }

                
                //清場
                myreader.close();
                myconn.close() ;

            }
            catch(sqlexception e)
            {
                throw(new exception("數據庫出錯:" + e.tostring())) ;
                //return null ;
            }

            return arrforumlist ;
        }
 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沙坪坝区| 垦利县| 鄂伦春自治旗| 绥江县| 河源市| 吴堡县| 康保县| 临西县| 盐山县| 金川县| 平武县| 保康县| 吴桥县| 庐江县| 泊头市| 平塘县| 丽水市| 边坝县| 周宁县| 陕西省| 汪清县| 醴陵市| 读书| 辉南县| 华亭县| 镇江市| 文登市| 广州市| 托里县| 玉屏| 乾安县| 凤山市| 岐山县| 祁阳县| 开江县| 于都县| 乐都县| 连城县| 革吉县| 斗六市| 黎城县|