三级列表出错!
做到了第三级的时候,切换第一级的时候,就会出错!用了try-catch,找到了出错代码行号71,但还是搞不懂怎么错的。求高人指点!
我把程序打包放到网盘中了,以下是下载地址:
http://yunpan.cn/QnSqTTnxbPPKk
360云盘,请放心,无毒
              
------解决方案--------------------  if (city!=null)
                {
                    DataSet set = SqlHelper.executeDataSet("select * from dbo.AreaFull where areapid = @pid", new SqlParameter("@pid", city.Id));
                    DataTable table = set.Tables[0];
                    DataRowCollection rows = table.Rows;
                    foreach (DataRow row in rows)
                    {
                        listCounty.Add(new Area((int)row[0], (string)row[1]));
                    }
                    lbCounty.ItemsSource = listCounty;
                }