コード例 #1
0
        /// <summary>得到一个对象实体
        ///
        /// </summary>
        public mhqNetAPP.Model.User GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from [user] ");
            strSql.Append(" where id=@id ");
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            h.AddParameter("@id", id);
            mhqNetAPP.Model.User model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }