从数据库向页面添加内容.

编程入门 行业动态 更新时间:2024-10-28 12:22:29
本文介绍了从数据库向页面添加内容.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

朋友们, 我正在创建一个网站,其中包含来自不同平台的游戏,并显示有关它的信息,并且注册用户可以对游戏发表评论. 因此,我需要创建一个页面game.aspx?id ="int value",该页面将包含从sql server 2005检索到的游戏图片,标题,说明. 请帮我,我需要明天提交这个项目. 在平台上,如pc.aspx中的页面不良帖子游戏

Hi friends, I am creating a web site which consist of games from different platforms and display information about it and registered users can comment on games. So i need to create a page game.aspx?id=''int value'' and this page will contain picture of the game, title, description which is retrieved from sql server 2005. Please help me I need to submit this project tomorrow. In platforms page ill post games like in pc.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="pc.aspx.cs" Inherits="pc" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_main" Runat="Server"> <div class="block"> <div class="block-bot"> <div class="head"> <div class="head-cnt"> <h3>PC Games</h3> <div class="cl">&nbsp;</div> </div> </div> <div class="col-articles articles"> <div class="cl">&nbsp;</div> <div class="article"> <div class="image"> <a href="game.aspx"> <img src="App_Themes/Theme1/css/images/img4.jpg" alt="" /> </a> </div> <h4><a href="#">F.E.A.R.2</a></h4> <p><strong>PC</strong></p> </div> <div class="cl">&nbsp;</div> </div> </div> </div> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="image_articles_games" Runat="Server"> </asp:Content>

现在我已经从服务器中的images文件夹中加载了pics,但是我想从sql server 2005中加载图像和其他信息. 在game.aspx页面中,我想显示游戏图片,标题,描述,等级,数据库注释 请尽快提供帮助.... 在另一面考虑

for now i have loaded the pics from images folder in the server but I want to load images and other information from sql server 2005 and in game.aspx page i want to display the game pics, title, description, ratings, comments from database Please help asap.... Regards

推荐答案

,这是您可以尝试的一件事.在SQL Server中将图像存储为字节(在SQL Server 2005中考虑其blob类型),然后创建一个HttpHandler来读取该Image列的内容,然后从该处理程序中执行Response.Write(< bytes>)以呈现该图像.页面上的图片.图像标签的src将是处理程序文件的路径,并附加一个查询字符串,例如id = 1,以获取与某个id对应的图像. 看看这是否对您有帮助. on the flip side, this is one thing you can try. Store Image as bytes in the SQL server (think its blob type in SQL server 2005) and then create an HttpHandler to read the contents of that Image column and then do a Response.Write(<bytes>) from the handler to render the image on the page. The image tag''s src would be the path of the handler file appended with a querystring say id=1, to fetch an image corresponding to a certain id. See if this helps you.

更多推荐

从数据库向页面添加内容.

本文发布于:2023-08-03 08:00:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1285445.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   数据库   内容

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!