DataSet ds = adao.GetList(0, "recommend=‘true‘", ""); List<ArticleInfo> list = new List<ArticleInfo>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ArticleInfo model = new ArticleInfo(); model.arttime = Convert.ToDateTime(ds.Tables[0].Rows[i]["arttime"]); model.cgyid = Convert.ToInt32(ds.Tables[0].Rows[i]["cgyid"]); model.clicks = Convert.ToInt32(ds.Tables[0].Rows[i]["cgyid"]); model.contents = Convert.ToString(ds.Tables[0].Rows[i]["cgyid"]); model.id = Convert.ToInt32(ds.Tables[0].Rows[i]["cgyid"]); model.img = Convert.ToString(ds.Tables[0].Rows[i]["cgyid"]); model.recommend = Convert.ToBoolean(ds.Tables[0].Rows[i]["cgyid"]); model.related = Convert.ToBoolean(ds.Tables[0].Rows[i]["cgyid"]); model.title = Convert.ToString(ds.Tables[0].Rows[i]["cgyid"]); model.uid = Convert.ToInt32(ds.Tables[0].Rows[i]["cgyid"]); list.Add(model); } ViewBag.list = list;