Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Saving an image to SQL Server's image datatype

 
   Database Help (Home) -> Full Text RSS
Next:  SELECTing a range from the results  
Author Message
Nathan Sokalski

External


Since: Jul 17, 2008
Posts: 3



(Msg. 1) Posted: Thu Jul 17, 2008 11:38 am
Post subject: Saving an image to SQL Server's image datatype
Archived from groups: microsoft>public>dotnet>framework>aspnet, others (more info?)

I am using ASP.NET 2.0, and need to know how to save and use an image that
is stored in an SQL Server image datatype. How can I do this using ASP.NET?
Thanks.

 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
Stuart Ainsworth

External


Since: Jan 10, 2008
Posts: 91



(Msg. 2) Posted: Thu Jul 17, 2008 11:38 am
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 17, 11:38 am, "Nathan Sokalski" <nsokal....DeleteThis@kyledavidgroup.com>
wrote:
> I am using ASP.NET 2.0, and need to know how to save and use an image that
> is stored in an SQL Server image datatype. How can I do this using ASP.NET?
> Thanks.

google is your friend...

http://www.codeproject.com/KB/web-image/PicManager.aspx
http://aspalliance.com/articleViewer.aspx?aId=138
http://bytes.com/forum/thread287108.html

HTH,
Stu

 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
TheSQLGuru

External


Since: Jan 11, 2008
Posts: 545



(Msg. 3) Posted: Thu Jul 17, 2008 4:06 pm
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Or search.live.com. Smile

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"Stuart Ainsworth" <stuart.ainsworth.RemoveThis@gmail.com> wrote in message
news:09cb5237-9e9f-440c-99df-74b0fa4d676e@34g2000hsh.googlegroups.com...
On Jul 17, 11:38 am, "Nathan Sokalski" <nsokal....RemoveThis@kyledavidgroup.com>
wrote:
> I am using ASP.NET 2.0, and need to know how to save and use an image that
> is stored in an SQL Server image datatype. How can I do this using
> ASP.NET?
> Thanks.

google is your friend...

http://www.codeproject.com/KB/web-image/PicManager.aspx
http://aspalliance.com/articleViewer.aspx?aId=138
http://bytes.com/forum/thread287108.html

HTH,
Stu
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
Linchi Shea

External


Since: Jan 19, 2008
Posts: 205



(Msg. 4) Posted: Thu Jul 17, 2008 8:19 pm
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: microsoft>public>dotnet>framework>aspnet, others (more info?)

A well-kept secret Smile

"TheSQLGuru" wrote:

> Or search.live.com. Smile
>
> --
> Kevin G. Boles
> Indicium Resources, Inc.
> SQL Server MVP
> kgboles a earthlink dt net
>
>
> "Stuart Ainsworth" <stuart.ainsworth.RemoveThis@gmail.com> wrote in message
> news:09cb5237-9e9f-440c-99df-74b0fa4d676e@34g2000hsh.googlegroups.com...
> On Jul 17, 11:38 am, "Nathan Sokalski" <nsokal....RemoveThis@kyledavidgroup.com>
> wrote:
> > I am using ASP.NET 2.0, and need to know how to save and use an image that
> > is stored in an SQL Server image datatype. How can I do this using
> > ASP.NET?
> > Thanks.
>
> google is your friend...
>
> http://www.codeproject.com/KB/web-image/PicManager.aspx
> http://aspalliance.com/articleViewer.aspx?aId=138
> http://bytes.com/forum/thread287108.html
>
> HTH,
> Stu
>
>
>
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
Rahul

External


Since: Jan 30, 2008
Posts: 52



(Msg. 5) Posted: Thu Jul 17, 2008 10:43 pm
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 18, 8:19 am, Linchi Shea <LinchiS... DeleteThis @discussions.microsoft.com>
wrote:
> A well-kept secret Smile
>
>
>
> "TheSQLGuru" wrote:
> > Or search.live.com.  Smile
>
> > --
> > Kevin G. Boles
> > Indicium Resources, Inc.
> > SQL Server MVP
> > kgboles a earthlink dt net
>
> > "Stuart Ainsworth" <stuart.ainswo... DeleteThis @gmail.com> wrote in message
> >news:09cb5237-9e9f-440c-99df-74b0fa4d676e@34g2000hsh.googlegroups.com...
> > On Jul 17, 11:38 am, "Nathan Sokalski" <nsokal... DeleteThis @kyledavidgroup.com>
> > wrote:
> > > I am using ASP.NET 2.0, and need to know how to save and use an image that
> > > is stored in an SQL Server image datatype. How can I do this using
> > > ASP.NET?
> > > Thanks.
>
> > google is your friend...
>
> >http://www.codeproject.com/KB/web-image/PicManager.aspx
> >http://aspalliance.com/articleViewer.aspx?aId=138
> >http://bytes.com/forum/thread287108.html
>
> > HTH,
> > Stu- Hide quoted text -
>
> - Show quoted text -

Hi,
Saving image in database is not a good idea, this activity create
unnessary bulky database.
Ok.. If you want to save image in the database, you can use varbinary
datatype insteda of image, microsoft will remove image datatype in
there earlier version.

Rahul
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
ML

External


Since: Jan 15, 2008
Posts: 352



(Msg. 6) Posted: Fri Jul 18, 2008 4:05 am
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I've even heard of yahoo.com, but that might be a rumor.


ML

---
Matija Lah, SQL Server MVP
http://milambda.blogspot.com/
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
Linchi Shea

External


Since: Jan 19, 2008
Posts: 205



(Msg. 7) Posted: Fri Jul 18, 2008 2:51 pm
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> Saving image in database is not a good idea, this activity create
> unnessary bulky database.

It depends. If you have a large number of small images, you may be better
off storing them in the database. If you have a relatively small number of
large images, it may be better to keep them in the filesytem. If you want to
stream from these images, keep them outside of the database.

Linchi

"Rahul" wrote:

> On Jul 18, 8:19 am, Linchi Shea <LinchiS....RemoveThis@discussions.microsoft.com>
> wrote:
> > A well-kept secret Smile
> >
> >
> >
> > "TheSQLGuru" wrote:
> > > Or search.live.com. Smile
> >
> > > --
> > > Kevin G. Boles
> > > Indicium Resources, Inc.
> > > SQL Server MVP
> > > kgboles a earthlink dt net
> >
> > > "Stuart Ainsworth" <stuart.ainswo....RemoveThis@gmail.com> wrote in message
> > >news:09cb5237-9e9f-440c-99df-74b0fa4d676e@34g2000hsh.googlegroups.com...
> > > On Jul 17, 11:38 am, "Nathan Sokalski" <nsokal....RemoveThis@kyledavidgroup.com>
> > > wrote:
> > > > I am using ASP.NET 2.0, and need to know how to save and use an image that
> > > > is stored in an SQL Server image datatype. How can I do this using
> > > > ASP.NET?
> > > > Thanks.
> >
> > > google is your friend...
> >
> > >http://www.codeproject.com/KB/web-image/PicManager.aspx
> > >http://aspalliance.com/articleViewer.aspx?aId=138
> > >http://bytes.com/forum/thread287108.html
> >
> > > HTH,
> > > Stu- Hide quoted text -
> >
> > - Show quoted text -
>
> Hi,
> Saving image in database is not a good idea, this activity create
> unnessary bulky database.
> Ok.. If you want to save image in the database, you can use varbinary
> datatype insteda of image, microsoft will remove image datatype in
> there earlier version.
>
> Rahul
>
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
Nathan Sokalski

External


Since: Jul 17, 2008
Posts: 3



(Msg. 8) Posted: Thu Jul 24, 2008 11:20 am
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

OK, but regardless of my choice, I need to know what my code should look
like to get them into and out of the DB. I have used the FileUpload control
before to upload a file to the file system, but I have never put an image
(or any other type of file) into a database. If you know of any examples, it
would be extremely helpful. Thanks.

Nathan Sokalski
njsokalski.TakeThisOut@hotmail.com
http://www.nathansokalski.com/

"Linchi Shea" <LinchiShea.TakeThisOut@discussions.microsoft.com> wrote in message
news:463D76E8-BA5B-48AF-9458-26E4151D8EDB@microsoft.com...
>> Saving image in database is not a good idea, this activity create
>> unnessary bulky database.
>
> It depends. If you have a large number of small images, you may be better
> off storing them in the database. If you have a relatively small number of
> large images, it may be better to keep them in the filesytem. If you want
> to
> stream from these images, keep them outside of the database.
>
> Linchi
>
> "Rahul" wrote:
>
>> On Jul 18, 8:19 am, Linchi Shea <LinchiS....TakeThisOut@discussions.microsoft.com>
>> wrote:
>> > A well-kept secret Smile
>> >
>> >
>> >
>> > "TheSQLGuru" wrote:
>> > > Or search.live.com. Smile
>> >
>> > > --
>> > > Kevin G. Boles
>> > > Indicium Resources, Inc.
>> > > SQL Server MVP
>> > > kgboles a earthlink dt net
>> >
>> > > "Stuart Ainsworth" <stuart.ainswo....TakeThisOut@gmail.com> wrote in message
>> > >news:09cb5237-9e9f-440c-99df-74b0fa4d676e@34g2000hsh.googlegroups.com...
>> > > On Jul 17, 11:38 am, "Nathan Sokalski" <nsokal....TakeThisOut@kyledavidgroup.com>
>> > > wrote:
>> > > > I am using ASP.NET 2.0, and need to know how to save and use an
>> > > > image that
>> > > > is stored in an SQL Server image datatype. How can I do this using
>> > > > ASP.NET?
>> > > > Thanks.
>> >
>> > > google is your friend...
>> >
>> > >http://www.codeproject.com/KB/web-image/PicManager.aspx
>> > >http://aspalliance.com/articleViewer.aspx?aId=138
>> > >http://bytes.com/forum/thread287108.html
>> >
>> > > HTH,
>> > > Stu- Hide quoted text -
>> >
>> > - Show quoted text -
>>
>> Hi,
>> Saving image in database is not a good idea, this activity create
>> unnessary bulky database.
>> Ok.. If you want to save image in the database, you can use varbinary
>> datatype insteda of image, microsoft will remove image datatype in
>> there earlier version.
>>
>> Rahul
>>
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
Hans Kesting

External


Since: Jul 25, 2008
Posts: 1



(Msg. 9) Posted: Fri Jul 25, 2008 3:42 pm
Post subject: Re: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Nathan Sokalski laid this down on his screen :
> OK, but regardless of my choice, I need to know what my code should look like
> to get them into and out of the DB. I have used the FileUpload control before
> to upload a file to the file system, but I have never put an image (or any
> other type of file) into a database. If you know of any examples, it would be
> extremely helpful. Thanks.
>

I use a store procedure with a parameter of type "image". Inside that
procedure you can use that variable to insert into the table.

When calling that stored procedure from the .Net code, I use parameters
to supply the data. The image-type parameter is then filled with the
byte[] containing that file.

Hans Kesting
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
steve

External


Since: May 28, 2007
Posts: 4



(Msg. 10) Posted: Sun Aug 03, 2008 7:03 am
Post subject: RE: Saving an image to SQL Server's image datatype [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hey Nathan,

An article on Large Object Storage in a Database or a Filesystem
http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2006-45


If you want to know how I do it:

I use and Image.aspx page and stream the image to that page then in and
other page i use and image controle and set the image.aspx page as image
path.
To get the connection I use linq in the example I make the query with linq
but that is not fast with large tables so you’re better off using stored
procedures with linq.

example:
The page with the image control
imgImageControl.ImageUrl = "Image.aspx?Id=2";


The image.aspx page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Try
Dim objNV As NameValueCollection
Dim pic() As Byte = Nothing
Dim strID As String = ""
objNV = Request.QueryString()
If Not objNV.Count = 0 Then
strID = objNV.Item("ID")
Else
pic = Session("Id")
If pic Is Nothing Then
strID = User.Identity.Name.ToString()
End If
End If
If Not strID = "" Then
Dim db As New
myDB(ConfigurationManager.ConnectionStrings("sql1").ConnectionString)
Dim Updateprofiel = (From p In db.Profiels Where p.Prof_ID =
strID Select p.Foto).ToList()(0)
If Not Updateprofiel Is Nothing Then
pic = Updateprofiel.ToArray()
End If
db.Connection.Close()
End If
If Not pic Is Nothing Then
Response.ContentType = "image/jpeg"
Response.OutputStream.Write(pic, 0, pic.Length)
End If
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Critical, "Big error run
away!!!!!")
End Try

End Sub

steve


"Nathan Sokalski" wrote:

> I am using ASP.NET 2.0, and need to know how to save and use an image that
> is stored in an SQL Server image datatype. How can I do this using ASP.NET?
> Thanks.
>
>
>
 >> Stay informed about: Saving an image to SQL Server's image datatype 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
sql 2000 sp4 image iflter issue - I have table with an image column that stores word documents. I added a cloumn called "DocumentType" and poulate it with .doc. I used the wizard to setup an FT index. I run a select staement like this one: SELECT document_name FROM Documents ...

restore to another server of db with FT catalogs - If we restore a backup copy of a production db having FT catalogs onto a laptop running SQL Server Developer version, the restored db will contain references to FT catalogs whose underlying system files are not yet present on the laptop (because backup..

Windows Server 2003 Ent. x64 Edition - Full-text Tuning - Running Windows Server 2003 Ent. x64 Edition on a quad Opteron server with 16G memory. SQL Server 2000 SP4. Total catalog files size ~2G . How do I optimize full-text search? Does OS do it by default? There does not seem to be ..

sql server 2005 database in restore mode - Hi folks I was restoring a database in SQL Server 2005 express edition. Due to a malfunction, system restarted. Now when I try to access the database, the status shows as "Restoring Database". I have tried to restart SQL Server and PC, but ...

funny search results with 'contains' clause - hi, it is really funny how ft search works: it seems to depend highly on what could be indexed, but it still doesn't follow a determined order. consider the following queries: select name from person where contains(name, 'hammer') select name from..
   Database Help (Home) -> Full Text All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]