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

蒙城網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),蒙城網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為蒙城上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的蒙城做網(wǎng)站的公司定做!
下面就是一個(gè)C#動(dòng)態(tài)數(shù)組實(shí)例:用綁定一個(gè)DataList的三層代碼
C#動(dòng)態(tài)數(shù)組之DAL 數(shù)據(jù)訪問(wèn)層代碼:
- //綁定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;
- }
- }
C#動(dòng)態(tài)數(shù)組之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
- {
- myAL.Add(ds.Tables[0].Rows[i][0].ToString() +
- " " +ds.Tables[0].Rows[i][1].ToString() );
- }
- return myAL;
- }
C#動(dòng)態(tài)數(shù)組之頁(yè)面層代碼:
- //綁定IDList,顯示所有人員列表
- private void SelectIDListAll()
- {
- Lab.BLL.TPeopleBiz peoplebiz = new TPeopleBiz();
- ArrayList myAL = peoplebiz.SelectIDListAll();
- this.P_IDlist.Items.Clear();
- for(int i = 0 ;i
- {
- this.P_IDlist.Items.Add(myAL[i]);
- }
- }
C#動(dòng)態(tài)數(shù)組的應(yīng)用實(shí)例就向你介紹到這里,希望對(duì)你了解和學(xué)習(xí)C#動(dòng)態(tài)數(shù)組有所幫助。
文章名稱:C#動(dòng)態(tài)數(shù)組實(shí)用實(shí)例解析
網(wǎng)頁(yè)網(wǎng)址:http://www.dlmjj.cn/article/djpohhc.html


咨詢
建站咨詢
