SQL Server - Insert pictures/photos to SQL Server 2000

Asked By morulis morulis on 16-May-05 10:33 AM
I am creating a DB with movies and I want to insert photos of actors and the cover of the movie? How this can be done from Query Ananlyzer or Enterprise Manager?

Hmmm - Asked By Robbe Morris on 16-May-05 10:53 AM

I don't know that you can via query analyzer manually.  You could probably cut/paste into a cell in Enterprise manager.

Why do you want to use these two specific manual tools?  Wouldn't you normally want to do this with ADO or ADO.NET?

insert picture into an sql table - Asked By jag hub on 03-Jun-05 10:16 AM

I am unable to insert a picture of type *.jpg into a table created in sybase sql server 12.5 and also I want to retrieve that photo and to show it in an web page

vb6 - Asked By Arafat Alarbeed on 14-Jun-05 09:29 AM

gfchdf
this is - Asked By Arafat Alarbeed on 14-Jun-05 09:31 AM
Save Data in a SQL Server Image Column with VB6
I needed to retrieve image fields on SQL Server 7.0 with VB6, and I couldn't find any article about it. So, I assume others have had the same problem. I've since found a method for doing it.

You must use Microsoft ADO 2.5 and set it into the following project reference:

 dim rst as new adodb.recordset
dim adoConn as new adodb.Connection

You also have to open the connection with the database.

 'Open recordset....
rst.Open "Select * from <TABLE> 
where <CONDITION>", adoConn, adOpenKeyset,
adLockOptimistic


'THIS FUNCTION SAVES AN IMAGE 
INTO AN IMAGE DATATYPE FIELD
Private Function SaveImage()
  Dim mStream As New ADODB.Stream

  With mStream
    .Type = adTypeBinary
    .Open
    .LoadFromFile "<IMAGE FILE 
NAME>"
    rst("<IMAGE FIELD NAME>"). 
Value = .Read
    rst.Update
  End With
  Set mStream = Nothing
End Function

'THIS FUNCTION LOAD IMAGE FROM 
IMAGE DATATYPE FIELD AND SAVE IT INTO A
FILE.....
Private Function LoadImage()
  Dim mStream As New ADODB.Stream

  With mStream
    .Type = adTypeBinary
    .Open
    .Write rst("<IMAGE FIELD NAME>")
    .SaveToFile "<DESTINATION FILE 
NAME>", adSaveCreateOverWrite
  End With

  Set mStream = Nothing

End Function

Aside from this method, you can use a picture control to store an image, put a picture control into a form, and call it PictureTemp.

 PictureTemp.DataField = "Immagine"			
'Set DataField....
Set PictureTemp.DataSource = rst			
'Set DataSource

You can use the PictureTemp.Picture property to get your image.

 Private Function LoadImage()
  Dim mStream As New ADODB.Stream

  With mStream
    .Type = adTypeBinary
    .Open
    PictureTemp.DataField = "Immagine"			
'Set DataField....
    Set PictureTemp.DataSource = rst			
'Set DataSource
    Set MSFGRID.CellPicture = PictureTemp.Picture	
'Show image into a cell of
Microsoft FlexGrid
  End With

  Set mStream = Nothing

End
Function
insert picture into sql 2000 - ravi parihar replied to morulis morulis on 16-Apr-09 02:54 PM
hii
i want to insert a picture into sql 2000 enterprise mannager..and from that i want to reterive picture into data grid veiw...
so plz send me code on ravi_rko85@yahoo.in
thnks