Read binary record from Database with ADODB.Stream

Discussion in 'ASP General' started by guyv, Mar 29, 2005.

  1. guyv

    guyv Guest

    Hello!

    I wanna read binary data from database with ADODB.Stream object.
    So I wrote code..

    ---------
    <%
    query = "SELECT * FROM Categories"
    adoDB.DefaultDatabase = "Northwind"

    adoRs.Open query, adoDB, 1

    Set rec = Server.CreateObject("ADODB.Record")

    'read [Picture] column.
    rec = adoRs(3)
    ------------

    And the 'rec' TypeName() is 'Byte()'

    But I can't get it to ADODB.Stream. How Can I do?
    Or Can I read binary column to another way?


    Pardon my poor English.
    Thanks.


    - GuyV -
     
    guyv, Mar 29, 2005
    #1
    1. Advertising

  2. guyv

    B_O_B Guest

    I think ADODB stream requires a physical file. Something like the following
    where errorImage is the file path.

    Set objStream = Server.CreateObject("ADODB.Stream")
    With objStream
    .Type = adTypeBinary
    .Open
    .LoadFromFile errorImage
    End With

    x = objStream.Read

    objStream.Close
    Set objStream = Nothing

    "guyv" wrote:

    > Hello!
    >
    > I wanna read binary data from database with ADODB.Stream object.
    > So I wrote code..
    >
    > ---------
    > <%
    > query = "SELECT * FROM Categories"
    > adoDB.DefaultDatabase = "Northwind"
    >
    > adoRs.Open query, adoDB, 1
    >
    > Set rec = Server.CreateObject("ADODB.Record")
    >
    > 'read [Picture] column.
    > rec = adoRs(3)
    > ------------
    >
    > And the 'rec' TypeName() is 'Byte()'
    >
    > But I can't get it to ADODB.Stream. How Can I do?
    > Or Can I read binary column to another way?
    >
    >
    > Pardon my poor English.
    > Thanks.
    >
    >
    > - GuyV -
    >
    >
    >
     
    B_O_B, Mar 31, 2005
    #2
    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. Hawksey
    Replies:
    3
    Views:
    1,016
    Mark Rae
    Nov 30, 2006
  2. bb2j3z
    Replies:
    1
    Views:
    5,412
    Alexey Smirnov
    Dec 12, 2008
  3. Andrew Durstewitz

    Server.CreateObject("ADODB.Stream")

    Andrew Durstewitz, Jul 3, 2003, in forum: ASP General
    Replies:
    0
    Views:
    211
    Andrew Durstewitz
    Jul 3, 2003
  4. peashoe
    Replies:
    4
    Views:
    141
    peashoe
    Oct 11, 2006
  5. peashoe
    Replies:
    0
    Views:
    123
    peashoe
    Oct 11, 2006
Loading...

Share This Page