Pulling images from Microsoft Access

Hi peeps.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Iam completely new to all this. I belong in a macromedia world of flash. lol. But I though I would come see what all the fuss is about and downloaded myself a copy of visual web developer.
It looks a really nice program and really powerful.

I have probably thrown my self in at the deep end a little as I have nooo idea how anything else works. But I have been looking at pulling data from an access database in to a data list. The connection seems to work fine when I looked at a debugged webpage of it, I can see records are being pulled in.
however I have set up a column in my access database as ole object and then used it to link to a small .jpg image.

When i view the database in the .aspx i can see all the relevant records except for the image record which says.... System.Byte[]
How come it doesn’t show the image And how do I get it to

thanks very much for any help

Aidan




Answer this question

Pulling images from Microsoft Access

  • radalin

    Shortly after writing you i found this, in which takes me back to the directions that you gave me, thank you for your response. I will use all of the above and find which one works best. Did you ever achieve this topic

    snowjoe

    The ImageField class is used by data-bound controls (such as GridView and DetailsView) to display an image for each record displayed. The ImageField object is displayed differently depending on the data-bound control in which it is used. For example, the GridView control displays an ImageField object as a column, while the DetailsView control displays it as a row.

    To display images, you must bind an ImageField object to a field from a data source that contains the URL of an image. This is accomplished by setting the DataImageUrlField property. The URL value can be formatted by using the DataImageUrlFormatString property. Each image can also have alternate text associated with it. This text is displayed when an image cannot be loaded, or is unavailable. Browsers that support the ToolTips feature also display this text as a ToolTip. You can specify the alternate text for a displayed image by using one of the following methods:

    • Use the AlternateText property to specify alternate text that applies to all images.

    • Use the DataAlternateTextField property to bind a field from a data source to the AlternateText property of each image. This allows you to have different alternate text for each image displayed. When binding data, you can optionally format the alternate text by using the DataAlternateTextFormatString property.

    When the URL value for an image is a null reference (Nothing in Visual Basic), an image cannot be displayed. You can display an alternate image for a null reference (Nothing in Visual Basic) field values by setting the NullImageUrl property. Instead of an alternate image, you can display alternate text by setting the NullDisplayText property.

    By default, all declared fields are displayed in a data-bound control. You can hide an ImageField object in a data-bound control by setting the Visible property to false.

    You can customize the header and footer sections of an ImageField object. To display a caption in the header or footer section, set the HeaderText or FooterText properties, respectively. To display an image in the header section instead of text, set the HeaderImageUrl property. The header section can be hidden in the ImageField object by setting the ShowHeader property to false.


  • Praveenkmenon

    When you store something in an OLE field, Access adds some additional information in the form of an OLE Header so that it can deal with the BLOB later. The net result of this is that your .jpg is not a .jpg anymore, it's actually an Access OLE Header, plus a DIB representation of the graphic plus the original .jpg.

    The only way to do what you're looking for is to extract the original .jpg file out of the rest of the OLE junk. I don't have a documented way to do this for .jpg, but there are articles about doing this with .bmp and .gif that might put you on the path:

    175261 How To Retrieve Bitmap from Access and Display It in Web Page
    http://support.microsoft.com/default.aspx scid=kb;EN-US;175261

    173308 How To Display Images Stored in a BLOB Field
    http://support.microsoft.com/default.aspx scid=kb;EN-US;173308

    Another way to accomplish this is to not use the OLE feature of the OLE field, and just dump your graphics in as BLOBs. You need to do some work up front when storing the pictures as described in:

    210486 ACC2000: Reading, Storing, and Writing Binary Large Objects (BLOBs)
    http://support.microsoft.com/default.aspx scid=kb;EN-US;210486

    Finally, it's usually easier in the long run to just serve you pictures of the file system with image links and store the file paths in the database if you want to have a web page dynamically driven by database content.

    Hope this helps,

    Mike



  • hsiceo

    Hello.

    I am using a SQL Server (2005 Enterprise Edition) DB, which is upsized from MS Access. On MS Access, I insert about thirty images as OLE object in "file_name" field.

    And i am using Visual Web Developer 2005 Express Edition. I connected to my SQL Server DB, made a query, and set the gridview's datasource. As a result, the gridview in design mode shows only three columns excluding "file_name" field. So i tried to add new column (imagefield) of the gridview, and set "DataImageUrlField" as a "file_name". Then run the web, and all images display 'X' marks. (I know it's not for image object, but i don't know what to do..so i just tried..)

    I tried in many ways, and sometimes, i got the System.bite[] too. but i did not remember when i get the message..

    I am not make sure where is the problem in displaying this kind of images

    When upsizing to SQL Server, is it possible that the images are lost How can i check those images are successfully upsized to SQL Server

    But when i look at the SQL Server DB (the upsized one), the column type is set as 'image'. so i thought it was successfully migrated.

    I do not know what should i do now.. would you give me a solution

    Thanks a lot in advance.

    Suyang,


  • pkonrad

    I am trying to do the same thing, have you found a solution yet

    Lets chat as soon as possible, maybe we can help each other.

    snowjoe


  • Pitipied

    Did you fix your problem If not all you have to do is store the images outside the app_data Folder, preferably in your web server folder (where your index.html or defult.aspx files resides). This will do the trick.
  • Joe Rohde - MSFT

    Hello Aidan

    I had to see what the fuss was all about to. Tell me what your trying to do. I have your fix, but i need to know the layout of your ftp: or tell me where your storing your db, and what kind of db your using


  • Cinni Patel

    Hi guys,

    Thanks for your replys. Will look at the image problem when i get the chance.

    As im sure alot of you have realised now iam new to visual web develop.

    I now have problems looks at it when i upload to the web.

    As crude as it is i just uploaded the whole folder that i have designed the website in.

    But i get an error once it has been uploaded... which i dont really understand. u can have a look at this address...
    http://www.aidanmack.co.uk/WebSite7/Default.aspx

    It all works find if I preview you it locally.

    Could any tell me what i am doing wrong

    thanks aidan.



  • qpeHukc

    Hi~ I am still in trouble in displaying an image object (BLOB) on the Web. I could not progress any more. This word, System.bite[], is only displayed. Did you find any solution If you do, please give me an advice....

    Thanks.

    Suyang


  • Pulling images from Microsoft Access