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

            strSql.Append("select  top 1 * from [" + databaseprefix + "DetailContent] ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            FileContentModel model = new FileContentModel();
            DataSet          ds    = DbHelperFileContentSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model = ChangeSimpleRowToFile(ds.Tables[0].Rows[0]);
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取文件内容
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public byte[] GetContent(string id)
        {
            id = "'" + id + "'";
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 File_Content from [" + databaseprefix + "DetailContent] ");
            strSql.Append(" where id=" + id);


            DataSet ds = DbHelperFileContentSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return((byte[])ds.Tables[0].Rows[0]["File_Content"]);
            }
            else
            {
                return(null);
            }
        }