|
-
November 22nd, 2006, 05:41 PM
#1
Invalid Picture
I'm using this code to create an image file from the data in SQL Server:
Dim RS As ADODB.Recordset
Dim mstream As ADODB.Stream
Set RS = New ADODB.Recordset
RS.Open "Select HighLogo from CompanyData WHere CompanyID = " & lngCompanyID, objConn, adOpenKeyset, adLockOptimistic
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.Write RS.Fields("HighLogo").Value
mstream.SaveToFile "c:\publogo.bmp", adSaveCreateOverWrite
Picture1.Picture=LoadPicture("c:\publogo.bmp")
I get an error "Invalid Picture"
File is created, but I cannot open it with Paint or Photoshop.
I link to the table in SQL Server from Access (I don't know any other way to see the picture in SQL Server field) and I can see the image there. So, SQL Server contains an image.
I tried to insert different format images into the table (BMP, JPG, GIF). All of them I can see via Access.
But when I retrieve the image and save as a disk file (tried with different extentions too), the file cannot be opened.
What's wrong?
Thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|