Solved

How to upload image in msacess

Posted on 2008-11-01
1
271 Views
Last Modified: 2012-05-05
I want to upload and reterive a image file in ms acess.I am making a desktop application in vb.net and in backend in ms acess..
0
Comment
Question by:raboy007
1 Comment
 
LVL 12

Accepted Solution

by:
techExtreme earned 500 total points
ID: 22857894
Hello,
Follow this article, there it is explained in detail with source code for how you can pass image in byte stream format to upload to ms access database.
Article: http://programming.top54u.com/post/VB-Code-to-Upload-Image-to-MS-Access-Database-in-ASP-Net.aspx
Still I'm pasting code here for your reference

Dim imageSize As Int64 

Dim imageType As String 
 

Dim imageStream As Stream 
 

' Gets the Size of the Image 
 

imageSize = fileImgUpload.PostedFile.ContentLength 

  
 

' Gets the Image Type 
 

imageType = fileImgUpload.PostedFile.ContentType 

  
 

' Reads the Image stream 
 

imageStream = fileImgUpload.PostedFile.InputStream 

  
 

Store the InputStream using the above ASP file upload control function into the Stream type variable.  

  
 

Dim imageContent(imageSize) As Byte 
 

Dim intStatus As Integer 
 

intStatus = imageStream.Read(imageContent, 0, imageSize) 

  
 

Create the Byte array as in the above code to buffer the image binary stream byte by byte. 
 

To use the stream, you can import the following IO namespace: 
 

Imports System.IO

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now