public List <School三级类别表> 查询三级类别s(int id) { try { StringBuilder sb = new StringBuilder(); string sql = string.Format("SELECT * FROM 三级类别表 WHERE SSID = {0} ", id); SqlDataReader read = DBHelper.ExecuteReader(DBHelper.ConnectionString, CommandType.Text, sql.ToString()); List <School三级类别表> list = new List <School三级类别表>(); //School三级类别表 modelx = new School三级类别表(); //modelx.ID = 0; //modelx.名称 = "全部"; //list.Add(modelx); while (read.Read()) { School三级类别表 model = new School三级类别表(); model.ID = Convert.ToInt32(read["ID"]); model.称 = read["名称"].ToString(); list.Add(model); } return(list); } catch (Exception) { throw; } }
public List <School三级类别表> 级(string kind) { try { StringBuilder sb = new StringBuilder(); string sql = string.Format(" SELECT * FROM 三级类别表 WHERE SSID = (SELECT ID FROM 二级类别表 WHERE 名称 = '{0}') ", kind); SqlDataReader read = DBHelper.ExecuteReader(DBHelper.ConnectionString, CommandType.Text, sql.ToString()); List <School三级类别表> list = new List <School三级类别表>(); while (read.Read()) { School三级类别表 model = new School三级类别表(); model.ID = Convert.ToInt32(read["ID"]); model.称 = read["名称"].ToString(); list.Add(model); } return(list); } catch (Exception) { throw; } }