/// <summary> /// 得到一个对象实体 /// </summary> public Model.VUser GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM VUser "); strSql.Append(" WHERE ID=" + ID); Model.VUser model = null; using (DbDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (dr.Read()) { model = GetModel(dr); } return(model); } }
/// <summary> /// 由一行数据得到一个实体 /// </summary> private Model.VUser GetModel(DbDataReader dr) { Model.VUser model = new Model.VUser(); model.ID = DbHelperSQL.GetInt(dr["ID"]); model.LoginName = DbHelperSQL.GetString(dr["LoginName"]); model.Pass = DbHelperSQL.GetString(dr["Pass"]); model.RealName = DbHelperSQL.GetString(dr["RealName"]); model.Sex = DbHelperSQL.GetString(dr["Sex"]); model.Age = DbHelperSQL.GetString(dr["Age"]); model.Address = DbHelperSQL.GetString(dr["Address"]); model.Degree = DbHelperSQL.GetString(dr["Degree"]); model.Occupation = DbHelperSQL.GetString(dr["Occupation"]); model.Tel = DbHelperSQL.GetString(dr["Tel"]); model.LAT = DbHelperSQL.GetDouble(dr["LAT"]); model.LON = DbHelperSQL.GetDouble(dr["LON"]); model.Flag = DbHelperSQL.GetBool(dr["Flag"]); return(model); }