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. …

Related Post

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

Leave a Reply

Comment Policy:

  • You must verify your comment by responding to the automated email that is sent to your email address. Unverified comments will never show.Leave a good comment that adds to the conversation and I'll leave your link in.
  • Leave me pure spam and I'll delete it.
  • Leave a general comment and I'll remove the link but keep the comment.

Notify me of followup comments via e-mail

Bear