VB Code to Upload Image to MS Access Database in ASP.Net

by top54u.com 29 Feb, 2008
Spotlight.....

As discussed in the last article to Upload Image to MS Access Database you can use OLE Object type field in MS Access Database table to store the byte stream of images sent by ASP.Net code.

Following code can used to stream the image binary stream into the memory stream:

 

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

 

You can learn how to load images from Ms Access into the ASP.Net Grid View Control here...

Download the free source code below:

ASP.Net Stream and Display Image from MS Access Database 

Spotlight.....

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

8/23/2008 9:05:14 PM

OUR SPONSORS[+ advertise here]
related videos.....
recent posts.....
top54u ezines.....