asp.net与数据库读取图片问题????

gdstcqs 2009-04-04 05:14:57
图片上传到数据库里,每次显示的时候只能显示一张图片,其他的图片看不到?怎样改才能看到所以图片啊??

显示图片代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档 </title>
</head>
<body>
<asp:Label ID="Label1" runat="server" Text="Label"> </asp:Label>
<%@ OutputCache duration="30" varybyparam="imageid"%>
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.sqlclient"%>
<script language="vb" runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim imageid As String = Request.QueryString("imageid")
Dim sqlcon As New SqlClient.SqlConnection("server=song;uid=sa;pwd=;database=xiaoshou")
'sql数据库
Dim sqlcmd As String
sqlcmd = "select image,contenttype,bytesizel from images "
Dim sqlcommand As New SqlClient.SqlCommand(sqlcmd.ToString, sqlcon)
sqlcon.Open()
Dim sqldr As SqlClient.SqlDataReader = sqlcommand.ExecuteReader(CommandBehavior.CloseConnection)
sqldr.Read()
Response.ContentType = sqldr("contenttype")
Response.OutputStream.Write(sqldr("image"), 0, sqldr("bytesizel"))
sqlcon.Close()
End Sub
</script>
</body>
</html>
...全文
70 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gdstcqs 2009-04-05
  • 打赏
  • 举报
回复
高手都去哪拉???
沉序员 2009-04-05
  • 打赏
  • 举报
回复
up
chenxiaohai2 2009-04-05
  • 打赏
  • 举报
回复
不好意思! 我是新手! 如何在<img>显示!
gdstcqs 2009-04-04
  • 打赏
  • 举报
回复
没人回答。。。

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧