Storing An Image To a Database in .NET

G07L0019

Several weeks ago I mentioned that I store the images that the user uploads to the system into the database.

Some of you have expressed an interest in how I do that.  So I plan to cover that today.

For the purposes of this article, I’m going to assume that you’ve already got the image uploaded and scaled and that all that is left is getting it into the database.

First, you need someplace to store your image.  For this, you will need a table in your database with a field of type image.

If you use a dataset as your means of accessing the dataset this will give you a field in the DataTable with a type of Byte Array (byte[]).

So it is a simple matter of taking the byte array that our scaling function returned to us and assigning it to the field in our database that has the photo and then updating our database using the new data.

Other places talking about Storing Images from .NET


Store-Retrieve binary data (BLOBs – Audio, Video, Image, Exe, etc … – Tutorial to Store-Retrieve binary data (BLOBs – Audio, Video, Image, Exe, etc.) in database in VB.Net using Array.

FileUpload Save Images in Database in ASP.NET C# VB.NET – NET with C# and VB.NET. Database is having a table named Images with three columns. 1. ID Numeric Primary key with Identity Increment. 2. ImageName Varchar to store Name of Image. 3. Image Image to store image in binary format. …

VB NET Upload image from VB.NET to Amazon S3 Project – Upload image from VB.NET to Amazon S3 freelance project is offered at RentACoder. You will need to have Coder account before you place your bid. If interested, you can get your RentACoder account. In case you already have an account with RentACoder, You can check Projects Details and Apply for … Amazon Product Price Database I am looking for a script that can query amazon at a preset interval (every 4 hours, every day etc thru a cron job) and save prices in a database. …


Other Related Items:

Hue Women's Micro Net LinerHue Women's Micro Net LinerKeep your feet feeling fabulous with this Micro Net Liner With Cotton Sole by Hue!
Into the WoodsInto the WoodsA fusion of fairytales in musical form, covering themes from Cinderella, Rapunzel, Jack and the Beanstalk, Little Red Riding Hood, and others.
Genre: Musicals
Rating: NR
Release Date: 21-JUL-1998
Media Type: DVD
The Sims That's life Ultimate Add-on packThe Sims(r) 'That's Life'Add-on pack is a rare import for use ONLY with the original Sims(r) PC program. Not a standalone item. Includes thousands of ... Read More >

If you're new here, you may want to subscribe to the mailing list to get notifications of new post and a virtual tour of past topics. Thanks for visiting!

Related Post

One Response to “Storing An Image To a Database in .NET”

DotNetNuke Sponsor

 

Most Valuable Blogger
Sponsor