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

首頁 > 開發(fā) > 綜合 > 正文

C#中動態(tài)數(shù)組(ArrayList )應(yīng)用實例子(三層代碼:數(shù)據(jù)訪問層,業(yè)務(wù)層,頁面層)

2024-07-21 02:27:43
字體:
供稿:網(wǎng)友
中國最大的web開發(fā)資源網(wǎng)站及技術(shù)社區(qū),

用綁定一個 datalist 的三層代碼說明一下:


dal 數(shù)據(jù)訪問層代碼:
------------------------------------------------------------
//綁定idlist,顯示所有人員列表
  public dataset selectidlistall()
  {
       string str = "select p_number,p_name from t_people";
       dataset ds = new dataset();

       mycon = new sqlconnection(dal.dalconfig.connectionstring);
       try
       {
        sqldataadapter mycomm = new sqldataadapter(str,mycon);
        mycomm.fill(ds,"t_people");   
               
        return ds;
       }
       catch(exception exc)
       {
        throw exc;
       }
  }


bll業(yè)務(wù)層代碼:
----------------------------------------------------------------
//綁定idlist,顯示所有人員列表
  public arraylist  selectidlistall()
  {
       dal.tpeopledao peopledao = new tpeopledao();
       dataset ds = new dataset();
       ds = peopledao.selectidlistall();

       // creates and initializes a new arraylist.
       arraylist myal = new arraylist();
       for(int i=0;i<ds.tables[0].rows.count;i++)
       {
        myal.add(ds.tables[0].rows[i][0].tostring() + " " +ds.tables[0].rows[i][1].tostring() );           
       }
       return myal;
  }


頁面層代碼:
-----------------------------------------------------------------
//綁定idlist,顯示所有人員列表
  private void selectidlistall()
  {
       lab.bll.tpeoplebiz peoplebiz = new tpeoplebiz();
       arraylist myal = peoplebiz.selectidlistall();
       this.p_idlist.items.clear();

       for(int i = 0 ;i<myal.count;i++)
       {
        this.p_idlist.items.add(myal[i]);
       }

  }


 

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 张家港市| 阳谷县| 朝阳区| 菏泽市| 繁昌县| 来宾市| 兴仁县| 安平县| 高淳县| 宜兴市| 古田县| 涞源县| 华坪县| 夏邑县| 河东区| 温州市| 韶关市| 文安县| 广州市| 台东县| 海南省| 赤壁市| 岳池县| 错那县| 吉木萨尔县| 盐城市| 娄底市| 镇坪县| 临漳县| 洱源县| 鹤壁市| 鄯善县| 宣汉县| 博野县| 菏泽市| 河源市| 镇远县| 铜川市| 新津县| 驻马店市| 阳朔县|