Re: Convert byte array to an Image

Discussion in 'ASP .Net' started by Ken Cox [Microsoft MVP], Jun 3, 2004.

  1. Is the image store in the database as a Blob? If so, check out Step 6 here?

    http://support.microsoft.com/default.aspx?scid=kb;en-us;326502

    Dim con As New
    SqlConnection("Server=yileiw2;uid=sqlauth;pwd=sqlauth;database=pubs")
    Dim da As New SqlDataAdapter("Select * From pub_info", con)
    Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
    Dim ds As New DataSet()

    con.Open()
    da.Fill(ds, "Pub_info")
    Dim myRow As DataRow
    myRow = ds.Tables("Pub_info").Rows(0)

    Dim MyData() As Byte
    MyData = myRow("logo")

    Response.Buffer = True
    Response.ContentType = "Image/JPEG"
    Response.BinaryWrite(MyData)

    MyCB = Nothing
    ds = Nothing
    da = Nothing

    con.Close()
    con = Nothing

    "Nonnie" <> wrote in message
    news:...
    > Hi,
    > Could anyone tell me how to load an image from a byte array without
    > storing the image file on the disk?
    > My image is basically saved in the database in an 'Image; column, I get
    > the same as a byte array and need to load the image from this.
    > Thanks
     
    Ken Cox [Microsoft MVP], Jun 3, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kirby
    Replies:
    3
    Views:
    658
    Kirby
    Oct 8, 2004
  2. Shane Wealti

    convert byte[] to Byte[]

    Shane Wealti, Jun 13, 2005, in forum: Java
    Replies:
    5
    Views:
    42,335
    Brzezi
    Jun 13, 2005
  3. Replies:
    20
    Views:
    9,844
    licebmi
    Sep 7, 2009
  4. Polaris431
    Replies:
    8
    Views:
    773
    SM Ryan
    Dec 4, 2006
  5. M D

    convert 2 byte space to one byte

    M D, Oct 6, 2006, in forum: Javascript
    Replies:
    3
    Views:
    204
    Dr John Stockton
    Oct 6, 2006
Loading...

Share This Page