[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I save images and documents into SQL Server 2008?

Posted on 2009-05-07
15
Medium Priority
?
1,182 Views
Last Modified: 2012-05-06
I want to save images and documents into SQL Server 2008 with Visual Studio .NET 2008.
0
Comment
Question by:ReaL10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
  • +2
15 Comments
 
LVL 39

Accepted Solution

by:
abel earned 800 total points
ID: 24323185
There are basically two ways: one is storing the images/docs locally in a file system and putting the location and meta information in SQL Server the normal way, the other is storing the entire information inside SQL Server.

Guessing on the second option, here's a how-to: http://aspalliance.com/articleViewer.aspx?aId=138&pId=
0
 
LVL 7

Assisted Solution

by:thiyaguk
thiyaguk earned 800 total points
ID: 24323247
Yes, first option doesn't store the data in sqlserver .
For the Second one ,Please refer this also.




http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx
0
 

Author Comment

by:ReaL10
ID: 24323282
I see, but it's possible to save the entire document/image into SQL like MySQL?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:thiyaguk
ID: 24323301
Ofcourse. Any Binary data can be saved (The above link just does explain how to store image.)

http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx
You can save other file tyype to (same way)
0
 

Author Comment

by:ReaL10
ID: 24323345
Ok, I understand that save documents is equal like to save images?
0
 
LVL 39

Expert Comment

by:abel
ID: 24323347
> I see, but it's possible to save the entire document/image into SQL like MySQL?

well, that's precisely what my link shows you... This part is what you are after at that link (note the use of SqlDbType.Image, this does not mean 'picture' but means a bunch of bytes):

Dim prmPersonImage As New SqlParameter("@PersonImage", SqlDbType.Image)prmPersonImage.Value = ImageContentmyCommand.Parameters.Add(prmPersonImage)
0
 
LVL 39

Expert Comment

by:abel
ID: 24323350
> Ok, I understand that save documents is equal like to save images?

indeed. In fact, this way you can save any type of binary data.
0
 
LVL 39

Expert Comment

by:abel
ID: 24323355
PS: in the code snippet above ImageContent is a byte array. See mine or thiyaguk links for how to do the whole process: from picture/doc to byte array to storage.
0
 

Author Comment

by:ReaL10
ID: 24323366
Ok, thanks.
0
 
LVL 39

Expert Comment

by:abel
ID: 24323380
welcome :)
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 200 total points
ID: 24324568
SQL 2008 has a new feature exactly to do that. Read about FileStream in BOL.
0
 

Assisted Solution

by:praveenkumar_3i
praveenkumar_3i earned 200 total points
ID: 24334085
Create a blob field into a table.
Insert the blob object with the file/image stream.

0
 
LVL 39

Expert Comment

by:abel
ID: 24334302
Just out of curiosity, but are there still problems rising? You last comment was a "thanks", but perhaps I mistakenly understood that as "everything works" ...
0
 

Author Comment

by:ReaL10
ID: 24334349
No, I said thanks for the possible solutions, but still I have not tried.
0
 
LVL 39

Expert Comment

by:abel
ID: 24334366
ok, np. Take your time :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question