• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1185
  • Last Modified:

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

I want to save images and documents into SQL Server 2008 with Visual Studio .NET 2008.
0
ReaL10
Asked:
ReaL10
  • 7
  • 4
  • 2
  • +2
4 Solutions
 
abelCommented:
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
 
thiyagukTech Lead Commented:
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
 
ReaL10Author Commented:
I see, but it's possible to save the entire document/image into SQL like MySQL?
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
thiyagukTech Lead Commented:
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
 
ReaL10Author Commented:
Ok, I understand that save documents is equal like to save images?
0
 
abelCommented:
> 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
 
abelCommented:
> 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
 
abelCommented:
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
 
ReaL10Author Commented:
Ok, thanks.
0
 
abelCommented:
welcome :)
0
 
Éric MoreauSenior .Net ConsultantCommented:
SQL 2008 has a new feature exactly to do that. Read about FileStream in BOL.
0
 
praveenkumar_3iCommented:
Create a blob field into a table.
Insert the blob object with the file/image stream.

0
 
abelCommented:
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
 
ReaL10Author Commented:
No, I said thanks for the possible solutions, but still I have not tried.
0
 
abelCommented:
ok, np. Take your time :)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 7
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now