Shaurya

1>I have to retrive and display images that are present in a MS Access Database.

2>The images have been inserted in the database by the user by using the Insert Object Functionality of MS Access so the Image is displayed as Bitmap Image for .BMP and Package for .JPEG in the DataBase Image Field.

3>I have tried reading the data in a Byte Array and then display it but it dosent work that way.

//Obtain Image in a byte array
byImageArray = (byte[])Command.ExecuteScalar();

//Read the byte array to memory stream
MemoryStream memStream = new MemoryStream(byImageArray);

//Read Image from the memory stream into picture box.
picImage.Image=Image.FromStream(memStream);

An exception is thrown is Argument Exception:Parameter is not valid.

This code works fine if we store image in DataBase Programmitically by using Byte Array,but not when we access a image that had been directly in the table by user by using Insert Object Functionality of MS Access


Re: Visual Studio Tools for Office Accessing Image from MS Access and Displaying them in Windows Form

Tommy Williams - MSFT

I moved this thread to the Visual Studio Tools for Office forum. You might also consider one of the Access newsgroups if you don't get an answer here:

http://msdn.microsoft.com/newsgroups/topic.aspx url=/msdn-files/028/201/016/topic.xml






Re: Visual Studio Tools for Office Accessing Image from MS Access and Displaying them in Windows Form

Cindy Meister

Hi Shaurya

I'm afraid you're going to get the "run around" :-) Sorry about that, but the VSTO forum isn't a general Office support forum. It's specific for the VSTO technology, with a bit of object model support for Excel and Word. Access isn't part of the VSTO technology (even though the run-time is packaged with the product).

So here's a link to the Access programming newsgroup:

http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.access.modulesdaovba&lang=en&cr=US