There is only the difference of coding syntax to stream the binary data of image content type to upload it into MS Access Database using C#/VB in ASP.Net 2.0
Namespaces required:
using System.Data.OleDb;
OleDb is used to connect the web site forms with MS Access Database using Microsoft.Jet.OLEDB.4.0
using System.IO;
IO is used to create the memory stream variable that can store the binary format of the image content.
C# Code to Upload Image to MS Access Database:
int imageSize;
Stream imageStream;
// 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;
intStatus = imageStream.Read(imageContent, 0, imageSize);
Connection string to connect the ASP.Net 2.0 web application with MS Access Database:
// Access Database oledb connection string
// Using Provider Microsoft.Jet.OLEDB.4.0
Download the free source code in ASP.Net 2.0 using C#:
AccessImagesCSharp.zip (124.18 kb)
AccessImagesCSharp.rar (71.59 kb)
Be the first to rate this post
Tags: asp.net 2.0, upload image to database, load image from database, free source code, ms access
3/18/2008 3:14:34 PM
This site satisfy my requirment with good codding. If u have this king of codding please send me on my Email ID. Thanks..........
Pratik
3/19/2008 8:29:45 PM
hi, it is usefull when developing projects
premkumar
4/19/2008 9:07:51 PM
really useful post
Archit Shrivastav
4/20/2008 4:32:08 PM
how to store imagesize in database
laxman
4/20/2008 8:10:18 PM
Hi Laxman If you want to save imagesize in bytes then first of all create a new field img_size as number in MS Access database to store the imagesize. Then modify the insert query by adding the new img_size field along with its parameter (@img_size) to set its value. You can download the sample code provided with this article and apply the changes as above.
Top54u
8/23/2008 8:41:02 PM