//得到学院信息 public String getInstatuteInfo() { System.Data.DataSet newinfo = new System.Data.DataSet(); Maticsoft.BLL.学院表 SQLOption = new Maticsoft.BLL.学院表(); newinfo = SQLOption.GetAllList(); String ReturnJson = JsonConvert.SerializeObject(newinfo); return(ReturnJson); }
//学院信息 public List <object> GetInstuteInfo() { Maticsoft.BLL.学院表 xueyuanOption = new Maticsoft.BLL.学院表(); System.Data.DataSet newinfo = xueyuanOption.GetAllList(); //String ReturnJson = JsonConvert.SerializeObject(newinfo); //JObject jo = (JObject)JsonConvert.DeserializeObject(ReturnJson); //反序列化解析json字符串 var data = new List <object>(); int length = newinfo.Tables["ds"].Rows.Count; for (int i = 0; i < length; i++) { data.Add(new { InstituteId = newinfo.Tables["ds"].Rows[i]["学院编号"], InstituteName = newinfo.Tables["ds"].Rows[i]["学院"] }); } return(data); }