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

Recommended Answers

All 3 Replies

Please find a related article here. the code is for access . You just need to change the connection string for SQL Server.

hi can you help me? i want random
Display Image from SQL Database
using visual basic 5.0
thank you!!!:)

Not bad at all, but the file using is a bit messy. Byte array can be opened as a file this way:

Private Const SIPICTURE As String = "{7BF80980-BF32-101A-8BBB-00AA00300CAB}"

Private Type guid
  Data1 As Long
  Data2 As Integer
  Data3 As Integer
  Data4(7) As Byte
End Type


Private Declare Function CreateStreamOnHGlobal Lib "OLE32.DLL" (ByRef hGlobal As Any, ByVal fDeleteOnResume As Long, ByRef ppstr As Any) As Long
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
Private Declare Function CLSIDFromString Lib "OLE32.DLL" (ByVal lpsz As Long, ByRef pclsid As guid) As Long
 
Private Function chunk2ipicture(ByRef b() As Byte) As IPicture
  
  Dim istrm As IUnknown
  Dim tGuid As guid
  
  If Not CreateStreamOnHGlobal(b(LBound(b)), False, istrm) Then
    CLSIDFromString StrPtr(SIPICTURE), tGuid
    OleLoadPicture istrm, UBound(b) - LBound(b) + 1, False, tGuid, chunk2ipicture
  End If
  
  Set istrm = Nothing
  
End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.