Displaying images from an Access Database

Discussion in 'ASP General' started by kbrad, Apr 7, 2006.

  1. kbrad

    kbrad Guest

    I have an Access database set up with a number of text fields and a hyperlink
    field which references a different image per record. I am trying write ASP
    code to retrieve allt his data and images onto a web page. I have the data
    but the images are causing a problem.
    The code I am using is as follows:
    For the data:
    <TD><P><FONT COLOR="#000000"><% Response.Write rsRecordset("Fieldname")
    %></FONT></TD>
    This is fine.
    For the images:
    <TD><P><FONT COLOR="#000000"><img src=<% Response.Write
    rsRecordset("ImageFieldName") %>> </FONT></TD>
    With this I get the square with the little red cross in it.
    I have managed to get the image to appear by hard coing the link I have in
    one of my database fields but that isn't what I want.
    Can anyone help?
     
    kbrad, Apr 7, 2006
    #1
    1. Advertising

  2. kbrad

    Mike Brind Guest

    kbrad wrote:

    > I have an Access database set up with a number of text fields and a hyperlink
    > field which references a different image per record. I am trying write ASP
    > code to retrieve allt his data and images onto a web page. I have the data
    > but the images are causing a problem.
    > The code I am using is as follows:
    > For the data:
    > <TD><P><FONT COLOR="#000000"><% Response.Write rsRecordset("Fieldname")
    > %></FONT></TD>
    > This is fine.
    > For the images:
    > <TD><P><FONT COLOR="#000000"><img src=<% Response.Write
    > rsRecordset("ImageFieldName") %>> </FONT></TD>
    > With this I get the square with the little red cross in it.
    > I have managed to get the image to appear by hard coing the link I have in
    > one of my database fields but that isn't what I want.
    > Can anyone help?


    1. Do a View Source, and look at the results from
    rsRecordset("ImageFieldName"). You might see the problem that way.
    2. Right click on the redex and look at its properties. That's another
    way to track down the problem.

    Let us know what you find. If you can't resolve the problem, give us a
    sample of the contents of rsRecordset("ImageFieldName")

    --
    Mike Brind
     
    Mike Brind, Apr 7, 2006
    #2
    1. Advertising

  3. kbrad

    kbrad Guest

    When I do View Source as suggested I see
    <img src =#http://pcname/directory/imageName.jpg#>
    Are the # signs causing a problem? If so how do I get rid of them?

    When I hard code http://pcname/directory/imageName.jpg into the code I do
    get the correct image so it does recognise the path.

    When I right click the redex I see the file name with # at the end at the
    top of the properties box ie. imageName.jpg#
    Also the Address: is
    http://pcname/directory/TMPi8f7xda7h.asp#http://pcname/directory/imageName.jpg#
    Do you think this is right?


    "Mike Brind" wrote:

    >
    > kbrad wrote:
    >
    > > I have an Access database set up with a number of text fields and a hyperlink
    > > field which references a different image per record. I am trying write ASP
    > > code to retrieve allt his data and images onto a web page. I have the data
    > > but the images are causing a problem.
    > > The code I am using is as follows:
    > > For the data:
    > > <TD><P><FONT COLOR="#000000"><% Response.Write rsRecordset("Fieldname")
    > > %></FONT></TD>
    > > This is fine.
    > > For the images:
    > > <TD><P><FONT COLOR="#000000"><img src=<% Response.Write
    > > rsRecordset("ImageFieldName") %>> </FONT></TD>
    > > With this I get the square with the little red cross in it.
    > > I have managed to get the image to appear by hard coing the link I have in
    > > one of my database fields but that isn't what I want.
    > > Can anyone help?

    >
    > 1. Do a View Source, and look at the results from
    > rsRecordset("ImageFieldName"). You might see the problem that way.
    > 2. Right click on the redex and look at its properties. That's another
    > way to track down the problem.
    >
    > Let us know what you find. If you can't resolve the problem, give us a
    > sample of the contents of rsRecordset("ImageFieldName")
    >
    > --
    > Mike Brind
    >
    >
     
    kbrad, Apr 7, 2006
    #3
  4. kbrad

    Mike Brind Guest

    No, it's not right. I don't know where you are getting the hash/pound
    marks from. Have a look at your database table and see if they are
    there. If they are, then they must get there when you enter the data.


    The best way to get rid of them is go into the raw data and delete
    them, but if you can't, then you have to use replace() to get rid of
    them:

    <img src="<% = replace(rsRecordset("ImageFieldName"),"#","")%>">

    Incidentally, you forgot to put " before and after the image filename.
    That won't help either.

    --
    Mike Brind



    kbrad wrote:
    > When I do View Source as suggested I see
    > <img src =#http://pcname/directory/imageName.jpg#>
    > Are the # signs causing a problem? If so how do I get rid of them?
    >
    > When I hard code http://pcname/directory/imageName.jpg into the code I do
    > get the correct image so it does recognise the path.
    >
    > When I right click the redex I see the file name with # at the end at the
    > top of the properties box ie. imageName.jpg#
    > Also the Address: is
    > http://pcname/directory/TMPi8f7xda7h.asp#http://pcname/directory/imageName.jpg#
    > Do you think this is right?
    >
    >
    > "Mike Brind" wrote:
    >
    > >
    > > kbrad wrote:
    > >
    > > > I have an Access database set up with a number of text fields and a hyperlink
    > > > field which references a different image per record. I am trying write ASP
    > > > code to retrieve allt his data and images onto a web page. I have the data
    > > > but the images are causing a problem.
    > > > The code I am using is as follows:
    > > > For the data:
    > > > <TD><P><FONT COLOR="#000000"><% Response.Write rsRecordset("Fieldname")
    > > > %></FONT></TD>
    > > > This is fine.
    > > > For the images:
    > > > <TD><P><FONT COLOR="#000000"><img src=<% Response.Write
    > > > rsRecordset("ImageFieldName") %>> </FONT></TD>
    > > > With this I get the square with the little red cross in it.
    > > > I have managed to get the image to appear by hard coing the link I have in
    > > > one of my database fields but that isn't what I want.
    > > > Can anyone help?

    > >
    > > 1. Do a View Source, and look at the results from
    > > rsRecordset("ImageFieldName"). You might see the problem that way.
    > > 2. Right click on the redex and look at its properties. That's another
    > > way to track down the problem.
    > >
    > > Let us know what you find. If you can't resolve the problem, give us a
    > > sample of the contents of rsRecordset("ImageFieldName")
    > >
    > > --
    > > Mike Brind
    > >
    > >
     
    Mike Brind, Apr 7, 2006
    #4
  5. kbrad

    Mike Brind Guest

    Incidentally, how are you getting the image file names into the
    database?

    --
    Mike Brind



    Mike Brind wrote:
    > No, it's not right. I don't know where you are getting the hash/pound
    > marks from. Have a look at your database table and see if they are
    > there. If they are, then they must get there when you enter the data.
    >
    >
    > The best way to get rid of them is go into the raw data and delete
    > them, but if you can't, then you have to use replace() to get rid of
    > them:
    >
    > <img src="<% = replace(rsRecordset("ImageFieldName"),"#","")%>">
    >
    > Incidentally, you forgot to put " before and after the image filename.
    > That won't help either.
    >
    > --
    > Mike Brind
    >
    >
    >
    > kbrad wrote:
    > > When I do View Source as suggested I see
    > > <img src =#http://pcname/directory/imageName.jpg#>
    > > Are the # signs causing a problem? If so how do I get rid of them?
    > >
    > > When I hard code http://pcname/directory/imageName.jpg into the code I do
    > > get the correct image so it does recognise the path.
    > >
    > > When I right click the redex I see the file name with # at the end at the
    > > top of the properties box ie. imageName.jpg#
    > > Also the Address: is
    > > http://pcname/directory/TMPi8f7xda7h.asp#http://pcname/directory/imageName.jpg#
    > > Do you think this is right?
    > >
    > >
    > > "Mike Brind" wrote:
    > >
    > > >
    > > > kbrad wrote:
    > > >
    > > > > I have an Access database set up with a number of text fields and a hyperlink
    > > > > field which references a different image per record. I am trying write ASP
    > > > > code to retrieve allt his data and images onto a web page. I have the data
    > > > > but the images are causing a problem.
    > > > > The code I am using is as follows:
    > > > > For the data:
    > > > > <TD><P><FONT COLOR="#000000"><% Response.Write rsRecordset("Fieldname")
    > > > > %></FONT></TD>
    > > > > This is fine.
    > > > > For the images:
    > > > > <TD><P><FONT COLOR="#000000"><img src=<% Response.Write
    > > > > rsRecordset("ImageFieldName") %>> </FONT></TD>
    > > > > With this I get the square with the little red cross in it.
    > > > > I have managed to get the image to appear by hard coing the link I have in
    > > > > one of my database fields but that isn't what I want.
    > > > > Can anyone help?
    > > >
    > > > 1. Do a View Source, and look at the results from
    > > > rsRecordset("ImageFieldName"). You might see the problem that way.
    > > > 2. Right click on the redex and look at its properties. That's another
    > > > way to track down the problem.
    > > >
    > > > Let us know what you find. If you can't resolve the problem, give us a
    > > > sample of the contents of rsRecordset("ImageFieldName")
    > > >
    > > > --
    > > > Mike Brind
    > > >
    > > >
     
    Mike Brind, Apr 7, 2006
    #5
  6. kbrad

    Bob Lehmann Guest

    > I don't know where you are getting the hash/pound marks from.

    He's probably using Access's hyperlink "data type". Possibly useful in
    access, but completely useless anywhere else.

    Bob Lehmann

    "Mike Brind" <> wrote in message
    news:...
    > No, it's not right. I don't know where you are getting the hash/pound
    > marks from. Have a look at your database table and see if they are
    > there. If they are, then they must get there when you enter the data.
    >
    >
    > The best way to get rid of them is go into the raw data and delete
    > them, but if you can't, then you have to use replace() to get rid of
    > them:
    >
    > <img src="<% = replace(rsRecordset("ImageFieldName"),"#","")%>">
    >
    > Incidentally, you forgot to put " before and after the image filename.
    > That won't help either.
    >
    > --
    > Mike Brind
    >
    >
    >
    > kbrad wrote:
    > > When I do View Source as suggested I see
    > > <img src =#http://pcname/directory/imageName.jpg#>
    > > Are the # signs causing a problem? If so how do I get rid of them?
    > >
    > > When I hard code http://pcname/directory/imageName.jpg into the code I

    do
    > > get the correct image so it does recognise the path.
    > >
    > > When I right click the redex I see the file name with # at the end at

    the
    > > top of the properties box ie. imageName.jpg#
    > > Also the Address: is
    > >

    http://pcname/directory/TMPi8f7xda7h.asp#http://pcname/directory/imageName.jpg#
    > > Do you think this is right?
    > >
    > >
    > > "Mike Brind" wrote:
    > >
    > > >
    > > > kbrad wrote:
    > > >
    > > > > I have an Access database set up with a number of text fields and a

    hyperlink
    > > > > field which references a different image per record. I am trying

    write ASP
    > > > > code to retrieve allt his data and images onto a web page. I have

    the data
    > > > > but the images are causing a problem.
    > > > > The code I am using is as follows:
    > > > > For the data:
    > > > > <TD><P><FONT COLOR="#000000"><% Response.Write

    rsRecordset("Fieldname")
    > > > > %></FONT></TD>
    > > > > This is fine.
    > > > > For the images:
    > > > > <TD><P><FONT COLOR="#000000"><img src=<% Response.Write
    > > > > rsRecordset("ImageFieldName") %>> </FONT></TD>
    > > > > With this I get the square with the little red cross in it.
    > > > > I have managed to get the image to appear by hard coing the link I

    have in
    > > > > one of my database fields but that isn't what I want.
    > > > > Can anyone help?
    > > >
    > > > 1. Do a View Source, and look at the results from
    > > > rsRecordset("ImageFieldName"). You might see the problem that way.
    > > > 2. Right click on the redex and look at its properties. That's

    another
    > > > way to track down the problem.
    > > >
    > > > Let us know what you find. If you can't resolve the problem, give us

    a
    > > > sample of the contents of rsRecordset("ImageFieldName")
    > > >
    > > > --
    > > > Mike Brind
    > > >
    > > >

    >
     
    Bob Lehmann, Apr 8, 2006
    #6
    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. Matt
    Replies:
    0
    Views:
    388
  2. =?Utf-8?B?SmltIE1hY2U=?=

    Displaying images from a database in an image control

    =?Utf-8?B?SmltIE1hY2U=?=, May 5, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    391
    Ashish M Bhonkiya
    May 5, 2004
  3. Replies:
    2
    Views:
    7,674
  4. Just Me
    Replies:
    2
    Views:
    537
    John Mott
    Sep 4, 2007
  5. Atheeq Pasha
    Replies:
    0
    Views:
    104
    Atheeq Pasha
    Jan 25, 2010
Loading...

Share This Page