Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42359

Reading and writing images to MS-Access

$
0
0
The attached VS2012 project (using MS-Access 2007) shows how to take a image file and insert the file into a table in an MS-Access database along with retrieving images from an MS-Access database and viewing the images in a DataGridView without using Visual Studio data wizards. Before going any farther storing and retrieving images from databases is nothing new and is not a bad idea for databases such as MS-SQL Server, Oracle or IBM-DB2 but not a wise idea for MS-Access. Even though it is unwise to store images in MS-Access (mainly because they are not durable and known for corruption) developers will do so anyways a) because it's beyond their control b) they are willing to take the chance. An alternate method for MS-Access is to store images in a local folder and in the database reference them with a field for description, and base file name. The application would "know" where the images resides either from a configuration setting or perhaps in a table inside of the same database.

To use this in your project images need to be added to your ms-access table using code as shown in the example project rather than using MS-Access in detail view as this places a header in the field which takes additional code to get that image back out via OleDb.
Name:  ScreenShot1.jpg
Views: 40
Size:  183.7 KB

NOTE I tried to upload the project but the file size is too large. The solution is large as I use several images that push the file size past the limit so I uploaded the solution to SkyDrive here.
Attached Images
 

Viewing all articles
Browse latest Browse all 42359

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>