Exemplo n.º 1
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private Model.AssemblyPoint GetModel(DbDataReader dr)
 {
     Model.AssemblyPoint model = new Model.AssemblyPoint();
     model.ID       = DbHelperSQL.GetInt(dr["ID"]);
     model.Name     = DbHelperSQL.GetString(dr["Name"]);
     model.TID      = DbHelperSQL.GetInt(dr["TID"]);
     model.LON      = DbHelperSQL.GetDouble(dr["LON"]);
     model.LAT      = DbHelperSQL.GetDouble(dr["LAT"]);
     model.RoadType = DbHelperSQL.GetString(dr["RoadType"]);
     model.RoadID   = DbHelperSQL.GetInt(dr["RoadID"]);
     model.RoadName = DbHelperSQL.GetString(dr["RoadName"]);
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.AssemblyPoint GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM AssemblyPoint ");
            strSql.Append(" WHERE ID=" + ID.ToString());

            Model.AssemblyPoint model = null;
            using (SqlDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (dr.Read())
                {
                    model = GetModel(dr);
                }
                return(model);
            }
        }