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:

Legends of the Canyon: Classic ArtistsLegends of the Canyon: Classic ArtistsLEGENDS OF THE CANYON delivers the story of the advent of rock music spawned in the garden of the Hollywood Hills, Laurel Canyon. Crosby, Stills & Nas... Read More >
FLASHING BLOB BALL FIDGETFLASHING BLOB BALL FIDGETGreat for tactile, motor skill, and visual applications. Squeeze this 2.25 inch ball to create multi colored protuberances while activating the flashing lights inside. Assorted colors.

Related Post

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

DotNetNuke Sponsor

 

Most Valuable Blogger
Sponsor