public List <School一级类别表> 查询一级类别s() { try { StringBuilder sb = new StringBuilder(); sb.Append("SELECT * FROM dbo.一级类别表"); SqlDataReader read = DBHelper.ExecuteReader(DBHelper.ConnectionString, CommandType.Text, sb.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 ID = (SELECT SSID FROM 二级类别表 WHERE 名称 = '{0}' ) ", kind); SqlDataReader read = DBHelper.ExecuteReader(DBHelper.ConnectionString, CommandType.Text, sql.ToString()); List <School一级类别表> list = new List <School一级类别表>(); while (read.Read()) { School一级类别表 models = new School一级类别表(); models.ID = Convert.ToInt32(read["ID"]); models.称 = read["名称"].ToString(); list.Add(models); } return(list); } catch (Exception) { throw; } //return us.查询二级类别(id); }