I have been trying to make images appear in a table from a database i have created in MS Access this code

<td><%=(Recordset1.Fields.Item("Image").Value)%></td>

is the code that is original used that shows the path, i was told to replace the code with the one below the original but i seem to be getting an error in the table:

<td><IMG SRC = "Images/<%=(Recordset1.Image)%>"></td>

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Image'


Any ideas on how to make the image appear?
Thanks

You were almost right the first time...

<IMG SRC = "Images/<%= Recordset1.Fields.Item("Image").Value %>">

or...

strImage = Recordset1.Fields.Item("Image").Value

response.write"<IMG SRC=""Images/" & strImage & """>"

I have been trying to make images appear in a table from a database i have created in MS Access this code

<td><%=(Recordset1.Fields.Item("Image").Value)%></td>

is the code that is original used that shows the path, i was told to replace the code with the one below the original but i seem to be getting an error in the table:

<td><IMG SRC = "Images/<%=(Recordset1.Image)%>"></td>

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Image'


Any ideas on how to make the image appear?
Thanks

Hi, if the image is already stored in the database table, then i would be in binary format. You would have to output the contenttype and image data field in order for the image to be seen.

Response.ContentType = RecordSet("[ContentType]");
Response.BinaryWrite(RecordSet("[binary Image Field]"));

If the image stored in the table is only a path then you would output it regularly.

Response.Write("<img src='"+RecordSet(image filed)+"'/>");

or

<img src="<%=[RecordSet(image field)]%>"

I use Javascript, so a little tweaking my be needed if using VBscript.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.