自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

C#動態(tài)數(shù)組實(shí)用實(shí)例解析

開發(fā) 后端
C#動態(tài)數(shù)組實(shí)用實(shí)例向你介紹了一個(gè)DataList的三層代碼,希望通過一個(gè)C#動態(tài)數(shù)組實(shí)用實(shí)例對你理解和學(xué)習(xí)C#動態(tài)數(shù)組有所幫助。

C#動態(tài)數(shù)組(ArrayList )應(yīng)用可以說在C#開發(fā)中是十分常用的,那么具體的實(shí)用實(shí)例是如何實(shí)現(xiàn)的呢?具體的實(shí)現(xiàn)步驟和注意事項(xiàng)是什么呢?

下面就是一個(gè)C#動態(tài)數(shù)組實(shí)例:用綁定一個(gè)DataList的三層代碼

C#動態(tài)數(shù)組之DAL 數(shù)據(jù)訪問層代碼:

  1. //綁定IDList,顯示所有人員列表  
  2.   public DataSet SelectIDListAll()  
  3.   {  
  4.        string Str = "select p_number,p_name from t_people";   
  5.        DataSet ds = new DataSet();  
  6.  
  7.        myCon = new SqlConnection(DAL.DALConfig.ConnectionString);  
  8.        try 
  9.        {  
  10.         SqlDataAdapter mycomm = new SqlDataAdapter(Str,myCon);  
  11.         mycomm.Fill(ds,"t_people");      
  12.                   
  13.         return ds;  
  14.        }  
  15.        catch(Exception exc)  
  16.        {  
  17.         throw exc;  
  18.        }  
  19.   }  

C#動態(tài)數(shù)組之BLL業(yè)務(wù)層代碼:

  1. //綁定IDList,顯示所有人員列表  
  2.   public ArrayList  SelectIDListAll()  
  3.   {  
  4.        DAL.TPeopleDao peopledao = new TPeopleDao();  
  5.        DataSet ds = new DataSet();  
  6.        ds = peopledao.SelectIDListAll();  
  7.  
  8.        // Creates and initializes a new ArrayList.  
  9.        ArrayList myAL = new ArrayList();  
  10.        for(int i=0;i<ds.Tables[0].Rows.Count;i++)  
  11.        {   
  12.         myAL.Add(ds.Tables[0].Rows[i][0].ToString() +  
  13.  
  14.  " " +ds.Tables[0].Rows[i][1].ToString() );              
  15.        }  
  16.        return myAL;  
  17.   }  

C#動態(tài)數(shù)組之頁面層代碼:

  1. //綁定IDList,顯示所有人員列表  
  2.   private void SelectIDListAll()  
  3.   {  
  4.        Lab.BLL.TPeopleBiz peoplebiz = new TPeopleBiz();  
  5.        ArrayList myAL = peoplebiz.SelectIDListAll();  
  6.        this.P_IDlist.Items.Clear();  
  7.  
  8.        for(int i = 0 ;i<myAL.Count;i++)  
  9.        {  
  10.         this.P_IDlist.Items.Add(myAL[i]);  
  11.        }  
  12.  
  13.   }  

C#動態(tài)數(shù)組的應(yīng)用實(shí)例就向你介紹到這里,希望對你了解和學(xué)習(xí)C#動態(tài)數(shù)組有所幫助。

【編輯推薦】

  1. C#截取字符串函數(shù)實(shí)例解析
  2. C#截取字符串實(shí)際應(yīng)用淺析
  3. C#截取字符串實(shí)戰(zhàn)操作解析
  4. 淺析C#工作流以及功能
  5. C#工作流引擎的理解解析
責(zé)任編輯:仲衡 來源: 博客園
相關(guān)推薦

2009-09-02 16:14:21

C#動態(tài)創(chuàng)建數(shù)組

2009-09-17 18:14:05

C#動態(tài)數(shù)組

2009-09-02 11:18:10

C#動態(tài)數(shù)組

2009-09-02 16:20:22

C#動態(tài)創(chuàng)建數(shù)組

2009-08-19 11:13:49

C#操作Word

2009-08-28 11:09:35

C#數(shù)組初始化

2009-09-09 14:40:15

C# XML解析

2009-09-09 13:57:28

C# XML解析

2009-08-18 10:47:40

C#枚舉類型

2009-09-17 17:44:51

C#動態(tài)數(shù)組

2009-09-17 17:40:36

C#動態(tài)數(shù)組

2009-08-26 12:14:44

C#打印設(shè)置

2009-09-07 06:31:32

C#窗體移動

2009-08-19 16:09:15

C#操作Access

2009-08-31 18:17:32

C#接口編程

2009-09-02 10:58:02

C#動態(tài)數(shù)組

2009-09-02 11:02:57

C#動態(tài)數(shù)組

2009-09-17 18:07:22

C#動態(tài)數(shù)組

2009-08-31 17:16:12

C#實(shí)現(xiàn)接口

2009-08-28 12:31:06

C#靜態(tài)方法
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號