Skip to main content
Wurn
Known Participant
September 27, 2011
Question

Display MS Access images in webpage (Intranet)

  • September 27, 2011
  • 5 replies
  • 3224 views

Hey all, ive just found this link http://forums.adobe.com/message/3556930 which is pretty much close to my problem. I am using DW CS4 and asp classic to pull data from my Access db using a Recordset.

I can see all the text except the image link (only comes up as a red cross in white square) on my browser. I am using a Localhost server ( IIS ) setup, so it should show.

What could be wrong? Here's the code:


<td width="13%" height="33" align="left" valign="top"><label><img src="<%=(Recordset.Fields.Item("Content Type").Value)%>"></label></td>

<td width="16%" align="left" valign="top" class="main"><label>



<input name="contact" type="text" class="p" id="contact" value="<%=(Recordset.Fields.Item("contact").Value)%>" readonly="readonly">

</label></td>

<td width="15%" align="left" valign="top" class="main"><label>

<input name="title" type="text" class="p" id="title" value="<%=(Recordset.Fields.Item("title").Value)%>" readonly="readonly">

</label>

</td>

<td width="32%" align="left" valign="top" class="main"><label>

<textarea name="notes" cols="50" rows="2" readonly="readonly" class="p" id="notes"><%=(Recordset.Fields.Item("notes").Value)%></textarea>

</label></td>

<td width="15%" align="left" valign="top" class="main"><label class="p">

<input name="sale" type="text" class="p" id="sale" value="<%=(Recordset.Fields.Item("sale").Value)%>" size="20" readonly="readonly">

</label>

</td>

<td width="9%" align="left" valign="top" class="main"><label>

<input name="date" type="text" class="p" id="date" value="<%=(Recordset.Fields.Item("dbdate").Value)%>" size="12" readonly="readonly">

</label></td>

</tr>

 

In my Access Table the image is store as a "OLE Object" if it helps.

Thx in advance

This topic has been closed for replies.

5 replies

Wurn
WurnAuthor
Known Participant
October 2, 2011

Well it's good to hear that hand coding (hard coding) is still being done. As i have said, i have noticed on alot of forums when i ask for help, I allmost 95% of the time get the same answer. "use php and asp.net" or "why are you using DW and not MS Visual studio" etc... and then "use this application (that you have to buy), it will do what you need".

Looking at the tutorial, i used right in the beginning, by following the tut, it did what i wanted but in a lob side way. As you said bregent, "it breaks the behavior widget".

Thx for everyone's help. I will post here if i need some more advice.

Wurn
WurnAuthor
Known Participant
September 30, 2011

Apologies for sounding rude, not my intention. I am frustrated however with the coding thing. Ive asked many questions on many forums on different coding venture and well rarely did i get an answer that solved my queries. But for you help i am MUCH appreciated. I will follow up on your tutorial.

Now what i meant with my " has coding become a product of..." - Back a good few years when i worked in a small team where we developed Touch screen technologies and Web sites, the Web master use to write his own code from scratch. Nowadays i have noticed it seems as if applications and software do most of the coding for a person, and you do not need to repair the wheel, if you will, but rather buy a new one.

SO thx for your help, i will look at your tutorial and see what i can make of it and how to incorporate it into my INtranet.

THx again.

MurraySummers
Inspiring
September 30, 2011

If I can add my opinion, I think you are completely mistaken.  My ratio of hand coding to machine coding is quite high.  But I do let DW write the simple stuff or the tedious stuff.

Wurn
WurnAuthor
Known Participant
September 29, 2011

OK here it is:

<%@LANGUAGE="VBSCRIPT"%>

<!--#include file="Connections/Smit.asp" -->

<%

Dim Recordset

Dim Recordset_cmd

Dim Recordset_numRows

Set NOCOUNT = ON

Set Recordset_cmd = Server.CreateObject ("ADODB.Command")

Recordset_cmd.ActiveConnection = MM_Smit_STRING

Recordset_cmd.CommandText = "SELECT * FROM files"

Recordset_cmd.Prepared = true

Set Recordset = Recordset_cmd.Execute

Recordset_numRows = 0

%>

<%

Dim Repeat1__numRows

Dim Repeat1__index

Repeat1__numRows = -1

Repeat1__index = 0

Recordset_numRows = Recordset_numRows + Repeat1__numRows

%>

and

      <table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
  <td width="13%" height="33" align="left" valign="top"><label><img src="/{img_path}/<%=(Recordset.Fields.Item("img_name").Value)%>"></label></td>
  <td width="16%" align="left" valign="top" class="main"><label>
   
    <input name="contact" type="text" class="p" id="contact" value="<%=(Recordset.Fields.Item("contact").Value)%>" readonly="readonly">
  </label></td>
  <td width="15%" align="left" valign="top" class="main"><label>
    <input name="title" type="text" class="p" id="title" value="<%=(Recordset.Fields.Item("title").Value)%>" readonly="readonly">
  </label>
    </td>
  <td width="32%" align="left" valign="top" class="main"><label>
    <textarea name="notes" cols="50" rows="2" readonly="readonly" class="p" id="notes"><%=(Recordset.Fields.Item("notes").Value)%></textarea>
    </label></td>
  <td width="15%" align="left" valign="top" class="main"><label class="p">
    <input name="sale" type="text" class="p" id="sale" value="<%=(Recordset.Fields.Item("sale").Value)%>" size="20" readonly="readonly">
  </label>
    </td>
  <td width="9%" align="left" valign="top" class="main"><label>
    <input name="date" type="text" class="p" id="date" value="<%=(Recordset.Fields.Item("dbdate").Value)%>" size="12" readonly="readonly">
  </label></td>
</tr>

  </table>

I take it the " src="/{img_path}/" part is where i should put in the path to the newly linked images. Probablem is i do not know where its linked to seeing as it is kept in the Access db. I think

Participating Frequently
September 29, 2011

>ADODB.Fields (0x800A0CC1)

>Item cannot be found in the collection corresponding to the requested name or ordinal.

>/SAMIntranet/showx.asp, line 59

This tells me you are trying to reference an item that is not in your select list. It's possibly due to a typo in your code, or you are trying to access the binary image using the value attribute - which as I mentioned earlier is not possible. You still have not answered the question about which if any of those fields in your code is the image field. It's also not clear which line the error is occuring on, because you have not posted the code in its original format. If we don't know which line is 59, we can only guess.

It's also not clear why you are using form fields, but no form.

If you insist on storing the image in the database - which I would highly discourage - then you need to use completely different code if you want to display the image. Look here for details: http://www.codeproject.com/KB/asp/Display_Images_from_Data.aspx


Wurn
WurnAuthor
Known Participant
September 30, 2011

Hi Bregent, all i know is that it is working by usning the tutorial i mentioned in a previous post. Here's the page that is working. This is doing excately what i need. I just thought i'll try to simulate this in Dreamweaver CS4, but seeing as i cannot find the answer, i think i'll just stick to the version that is working. In saying that

When you click on any of the red links (Swop/for sale/tewst) then it opens the image. I am not trying to reinvent the wheel. I am perfectly happy with this method, just battling to be able to manipulate the table into the format i want it to be, but cannot do this. That is why i went the other route and re created the above page in DW CS4 and ended up asking you guys why Line 59 as supplied by SnakeEyz02 previously which was this <img src="/{img_path}/<%=(Recordset.Fields.Item("img_name").Value)%>"> , is giving me the following error?

ADODB.Fields (0x800A0CC1)

Item cannot be found in the collection corresponding to the requested name or ordinal.

/SAMIntranet/showx.asp, line 59

In all due respect Bregent,  the code you have asked for i posted previously. If you are not reading what i am asking then don't answer. Has coding become a product of copy and paste and download some app to do it all for you, rather than figuring it out? I would like to know how the tutorial i used can work for me, and how i can incorporate that into my method.

Thank you


Wurn
WurnAuthor
Known Participant
September 28, 2011

Unfortunately your suggestion brings up this error, you did say you are more at home with php. I will investigate some more in regards to the error.

ADODB.Fields (0x800A0CC1)

Item cannot be found in the collection corresponding to the requested name or ordinal.

/SAMIntranet/showx.asp, line 59

Participating Frequently
September 28, 2011

We would need to see the code to resolve any issues.

Participating Frequently
September 27, 2011

>I can see all the text except the image link

I don't see any links at all in that code.

First, it's not clear which, if any, of the items in that code are the actual image. Is it in there? DW will not create a field in the recordset for binary items - because you can not simpy use the value property to display them. It takes much more code.

Second, storing images in binary fields has largely been discontinued over the last 5-10 years because of performance problems. Couple that with the fact you are using Access and I guarantee this application would not scale well on the internet. The common way these days is to use a file system repository. That is, store the images (or other binary file) in the file system and store the path to the file (and other meta data) in the database.

Community Expert
September 27, 2011

Bregent, I share the same concerns as you.  Although they did state it will be for intranet, I'd be just as worried about availability as scalability.  From what I'm reading it appears Access it being used as a CRM suite (I see contact, title, notes and sale fields).

It's that information that makes me question these posts as to why the wheel needs to be re-invented.  There are plenty of viable solutions from web-based like Salesforce and Microsoft BPOS to client applications like ACT and GoldMine or a self-hosted solution like SugarCRM.  With any of those you should be able to easily attach images, PDFs or any file type and keep all data in sync without having to manage an Access database.  Plus with those solutions you don't run into the limitations of Access ( http://office.microsoft.com/en-us/access-help/access-2010-specifications-HA010341462.aspx ). Eliminate all the development cost and just worry about the maintenance cost.

Wurn
WurnAuthor
Known Participant
September 28, 2011

Hey guys thx for the replies. Im not a very good coder, so as i develop the Intranet at my company, im learning. I will research what you guys suggested.

I read through the following tutuorial  http://www.stardeveloper.com/articles/display.html?article=2001033101&page=1 on how to get a user to input their details, images included, and then view the information on another page, which works if one follows his format. I tweaked it a bit and well ran into this error by using DW's recordset structure instead hardcoding like he did.

So if you can maybe direct me to any good tutorials on how to do this using today's methods, that will be great. Otherwise i just though a simple fix of line 56 should do it but clearly not.