日期:2014-05-18  浏览次数:20402 次

接着刚才那个结题的泛型问题在问一下
public   struct   arrWare{
                        public   int   id;
                        public   string   name;
                        public   string   desc;
                }
                public   IList <arrWare>   GetWares()
                {
                        IList <arrWare>   wares   =   new   List <arrWare> ();
                        //IList <CustomersM>   customer   =   new   List <CustomersM> ();
                        strSql   =   "select   top   10   infoName,infos,infoId   from     WareInfo ";
                        //SqlParameter   parms   =   new   SqlParameter( "@id ",   SqlDbType.Int);
                        //parms.Value   =   id;
                        using   (SqlDataReader   rdr   =   SqlHelper.ExecuteReader(CommandType.Text,   strSql,   null))
                        {
                                arrWare   ar   =   new   arrWare();
                                while   (rdr.Read())
                                {
                                        ar.name   =   rdr.GetString(0);
                                        ar.desc   =   rdr.GetString(1);
                                        ar.id   =   rdr.GetInt32(2);
                                        wares.Add(ar);
                                }
                                return   wares;
                        }
                }

这获得的数据咱个使用呢?如有一个label控件,怎么才能把它的Text属性设为我这获得的ar.name

------解决方案--------------------
<asp:GridView ID= "GridView1 "