« Previous Next »

Thread: Displaying an image stored in an access database via asp

Last post 02-13-2008 2:58 PM by jeff@zina.com. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 02-13-2008, 2:34 PM

    Displaying an image stored in an access database via asp

    Hi, I have just created a database and plan to store images in it using an 'ole object' data type. I can store images in it but it is then accessing using asp I can't seem to get working. I can do normal queries to display text and numbers from the database, and have included one, but how/what would I need to change to display an image from the field image. How would I get it to display a specific image from a session variable.

    The query I have copied and pasted here is for one to list the name of all the images, so everything is how I would have it connected to the database.

     Any help would be really helpful.

    Thank You
    Crazy Dino


    <%
    Dim adoCon 'Database Connection Variable
    Dim strCon 'Holds the Database driver and the path and name of the database
    Dim strAccessDB 'Holds the Access Database Name
    Dim strSQL 'Database query sring

    strAccessDB = "datastore"
    Set adoCon = Server.CreateObject("ADODB.Connection")
    strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath(strAccessDB)
    adoCon.Open strCon

    'Database Query"

    set rsimage=Server.CreateObject("ADODB.recordset")
    sql="SELECT imagename FROM images"
     sql=sql
    rsimage.Open sql, adoCon
    'response.write(sql)

    Do While Not rsimage.eof
    response.write(rsimage("imagename"))
    response.write("</br>")
    rsimage.movenext
    loop
    %>

  • 02-13-2008, 2:58 PM In reply to

    Re: Displaying an image stored in an access database via asp

    Look for Wrox's new book Professional IIS 7 in your local bookstore, or order now at Amazon.com
Page 1 of 1 (2 items)
Microsoft Communities