<img src="showimg.aspx">
showimg.aspx中读取该图片,如何读取,搜索一下:)

解决方案 »

  1.   

    请参考这里:http://codechina.com/dispbbs.asp?boardID=5&ID=3183
      

  2.   

    download from here:http://msdn.microsoft.com/downloads/samples/internet/ASP_DOT_NET_ServerControls/WebControls/default.asp
      

  3.   

    Imports System.IO
    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
      

  4.   

    控件应该是实现不了这种功能,<img src="showimg.aspx?id=1"> 调用制定的叶面,在页面中显示图片