loading images from sql server using vb6

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2008
Posts: 23
Reputation: realone has a little shameless behaviour in the past 
Solved Threads: 0
realone realone is offline Offline
Newbie Poster

loading images from sql server using vb6

 
0
  #1
May 13th, 2008
pls help job at stake!!

An image is stored into database using delphi with a back end Access.This images were imported into sql server.Now i want to display the image using vb6.Please help with the code
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: loading images from sql server using vb6

 
0
  #2
May 14th, 2008
Please find a related article here. the code is for access . You just need to change the connection string for SQL Server.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 1
Reputation: gennadios1983 is an unknown quantity at this point 
Solved Threads: 0
gennadios1983 gennadios1983 is offline Offline
Newbie Poster

Re: loading images from sql server using vb6

 
0
  #3
Nov 21st, 2008
hi can you help me? i want random
Display Image from SQL Database
using visual basic 5.0
thank you!!!
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 97
Reputation: VIeditorlover is an unknown quantity at this point 
Solved Threads: 5
VIeditorlover's Avatar
VIeditorlover VIeditorlover is offline Offline
Junior Poster in Training

Re: loading images from sql server using vb6

 
0
  #4
Nov 21st, 2008
Not bad at all, but the file using is a bit messy. Byte array can be opened as a file this way:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2. Private Const SIPICTURE As String = "{7BF80980-BF32-101A-8BBB-00AA00300CAB}"
  3.  
  4. Private Type guid
  5. Data1 As Long
  6. Data2 As Integer
  7. Data3 As Integer
  8. Data4(7) As Byte
  9. End Type
  10.  
  11.  
  12. Private Declare Function CreateStreamOnHGlobal Lib "OLE32.DLL" (ByRef hGlobal As Any, ByVal fDeleteOnResume As Long, ByRef ppstr As Any) As Long
  13. Private Declare Function OleLoadPicture Lib "olepro32.dll" (ByVal lpStream As IUnknown, ByVal lSize As Long, ByVal fRunMode As Long, ByRef riid As guid, ByRef lplpObj As Any) As Long
  14. Private Declare Function CLSIDFromString Lib "OLE32.DLL" (ByVal lpsz As Long, ByRef pclsid As guid) As Long
  15.  
  16. Private Function chunk2ipicture(ByRef b() As Byte) As IPicture
  17.  
  18. Dim istrm As IUnknown
  19. Dim tGuid As guid
  20.  
  21. If Not CreateStreamOnHGlobal(b(LBound(b)), False, istrm) Then
  22. CLSIDFromString StrPtr(SIPICTURE), tGuid
  23. OleLoadPicture istrm, UBound(b) - LBound(b) + 1, False, tGuid, chunk2ipicture
  24. End If
  25.  
  26. Set istrm = Nothing
  27.  
  28. End Function
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 2025 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC