<img src="showimg.aspx">
showimg.aspx中读取该图片,如何读取,搜索一下:)
showimg.aspx中读取该图片,如何读取,搜索一下:)
解决方案 »
- ASP.net中的滑动翻页效果
- asp.net框架页刷新时如何保留或返回之前的页面
- IIS7的访问问题
- 请问该如何判断服务器的某个端口是否已经开放?谢谢
- 大家好,帮我看看这个索引超出了数组界限,是怎么回事?
- 苦求解决办法 ----- 如何给 Table 动态添加 TableRow ?
- 如何利用C#实习QQ聊天的功能。
- 在一个页面A里,我用window.open打开了另一个页面B,B里面有个ListBox,我想在ListBox选择多个值,然后返回到A页面的一个TextBox,该怎么做
- 菜鸟问题,高手们帮帮忙!急急急
- 刚配置好asp.net环境,好像还有点问题,请指教!
- 我是新手!我想学习ASP.NET技术,求助!
- 如何在asp.net中注册并应用一个外部的dll?
Imports System.IO.BinaryReader
Imports System.Data.SqlClient'
' ShowImage 网页:从 数据库 或 Session("PostedFile.ContentByte") 取出图片并输出到 Response 中
'Public Class PageShowImage Inherits System.Web.UI.Page Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' 确定 ItemID
Dim _ItemId As Integer = 0
If Not Request.Params("id") Is Nothing Then
_ItemId = Int32.Parse(Request.Params("id"))
End If ' 取图片数据
Dim _ImageType As String
Dim _ImageByte() As Byte
If _ItemId = 0 Then
' 从 Session 中取图片数据
If Not Session("PostedFile") Is Nothing Then
Dim _PostedFile As HttpPostedFile = CType(Session("PostedFile"), HttpPostedFile)
_ImageType = _PostedFile.ContentType
_ImageByte = Session("PostedFile.ContentByte")
End If
Else
' 从 数据库 中取图片数据
Dim myConn As New SqlConnection(PortalSettings.PortalConnString)
Dim myDA As New SqlDataAdapter(" select * from t_docs where c_id=" & _ItemId, myConn)
Dim myDS As New DataSet()
myConn.Open()
myDA.Fill(myDS, "t_docs")
If Not myDS.Tables("t_docs").Rows(0)("c_blob") Is DBNull.Value Then
_ImageType = myDS.Tables("t_docs").Rows(0)("c_blob_type")
_ImageByte = myDS.Tables("t_docs").Rows(0)("c_blob")
End If
myConn.Close()
End If ' 将图片输出到 Response
If Not _ImageByte Is Nothing Then
Response.Buffer = True
Response.ContentType = _ImageType
Response.BinaryWrite(_ImageByte)
End If
End SubEnd Class