DB中  有 图片的名称(string),图片的内容(image).
现在我能够将图片转成二进制存入DB.但是  在点选图片名称超连结时,不能显示图片.
请问如何 另开新页面显示图片 
这部分我写不出来.
我的部分代码如下:
屏闭掉的部分 和现行的代码都不可以,请大家指正.
就在              'MyFileStream = New FileStream(  这部分的创建  写不动了,哎!!!不知道如何写了啊.
'讀取文件
            'Dim aa As String = dsESTATE_PICTURE.Tables(0).Rows(0).Item("ESTATE_PICTURE")
            'Dim Buffer(aa) As Byte
            Response.ContentType = "Application/octet-stream"
            'Dim dd As String = dsESTATE_PICTURE.GetName("ESTATE_PIC_UID")
            Dim strESTATE_PICTURE As String = dsESTATE_PICTURE.Tables(0).Rows(0).Item("ESTATE_PICTURE").ToString()
            Dim ilength As Integer = strESTATE_PICTURE.Length
            Dim buf(ilength) As Byte
            'Response.BinaryWrite(buf)
            
            'Dim ad(CInt(dsESTATE_PICTURE.GetName("ESTATE_PICTURE").Length)) As Byte            'Dim MyFileStream As FileStream            'Dim FileSize As Long            'MyFileStream = New FileStream(
            'FileSize = MyFileStream.Length            'Dim Buffer(CInt(FileSize)) As Byte
            Response.OutputStream.Write(dsESTATE_PICTURE.Tables(0).Rows(0).Item("ESTATE_PICTURE"), 0, ilength)            'MyFileStream.Read(buf, 0, ilength)            'MyFileStream.Close()            'Response.Write("<b>File Contents: </b>")
            'Response.BinaryWrite(dsESTATE_PICTURE.GetBytes(2))
            'Dim aa(dsESTATE_PICTURE.GetName("ESTATE_PICTURE").Length) As Byte
            'aa = CType(dsESTATE_PICTURE.GetName("LOAN_UID"), Byte)
            'Response.BinaryWrite(buf)
            'End If
.最好给部分代码看一下,,谢谢啦!

解决方案 »

  1.   

    http://blog.csdn.net/sunnystar365/archive/2005/10/10/498719.aspx
    不过这个是C#语言的,可以参考一下
      

  2.   

    SqlConnection cn=new SqlConnection(conn);
       SqlCommand cmd=new SqlCommand();
       cmd.CommandText="select Image from UpImage";
       cmd.Connection=cn;
       cn.Open();
       this.Response.ContentType="image/jpeg";
       //this.Response.ContentType="image/bmp";
       //this.Response.ContentType="image/gif";
       SqlDataReader dr=cmd.ExecuteReader();
       while(dr.Read())
       {
        this.Response.BinaryWrite((byte[])dr["Image"]);
       }
       cn.Close();
    这个代码也可以,不过用Response.BinaryWrite()方法一个页面上只能显示一张图片