Wednesday, 30 March 2011

How to store Image in database using “Image datatype

Introduction- In this article, I will explain how we can store image in the database. This is very interesting article. The need to store image in database occur, when there is a issue of security. I mean we can store the image of the signature of the human, becoz of the banking security. To store the image in the database, here I am using byte[] array. First I will convert the image into byte array[] and then it will store in the database.

Implementation- Create a website, create a page named storeimage.aspx. Place a textbox named txt_name and a fileuploader named upload_image. Here textbox will use to enter the image name and fileuploader is used to upload the image. Also place a gridview at this page to show the image.Then go to the website menu and place a Handler.ashx file.

Database

Create a table named addimage. Here iam explainning the columns that we need for a table to insert the image in the data base.

About Me

Hello Friends. I am working as a Software Developer and has 2 years of experience on asp.net C# and having a Master Degree in MSC(IT). I really like to work in the .NET platform. and working with ASP.NET 2.0/3.5, AJAX, JavaScript,JQuery, Ado.net, SQL Server 2005/2008.