Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to read an image from a GENERAL field
Message
 
À
11/12/2006 06:01:55
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
SAMBA Server
Database:
Visual FoxPro
Divers
Thread ID:
01176470
Message ID:
01176497
Vues:
18
If original files are not available he can use ADO to bring the images back from the database. This is an example that uses SQL Server but making it work with VFP should not be difficult.
*--- Coneccion: Method that establish a connection to the database
*--- Getrs    : Method that execute a T-SQL Sentence against the DB
*--- Desconectarse: Method to finish the connection
*--- Datos    : Property that holds the ADO Recordset object created

Thisform.Coneccion()
	Thisform.Datos=Thisform.Getrs([Select * From Fotos Where Secuencia=6])
Thisform.Desconectarse 

cFile=ADDBS(SYS(2023))+Thisform.Datos.Fields('Nombre').Value

IF FILE(cFile)
	ERASE &cFile
ENDIF 

oSt = CREATEOBJECT("ADODB.Stream")
oSt.Open
oSt.Type=1 &&&& adTypeBinary


oSt.Write(Thisform.Datos.Fields('Foto').Value)
oSt.SaveToFile(cFile)
oSt.Close()
Thisform.image1.Picture=cFile 
Thisform.Refresh 
>>>Hallo Cetin,
>>>
>>>>copy next 1 imagefield to tempCursor
>>>>lowlevel open the tempcursor's fpt
>>>>get data starting at offset 599 (599 works for BMP but not the same for all file types).
>>>>
>>>>Cetin
>>>
>>>this may fail if your OLE provider for bmp is not windwos default. ::)
>>>
>>>There is only one problem I've found no way around. The picture/OLE Bound object of an report allows to center - but for general fields only. If I bound a file to it, it ends up in the upper left corner.
>>>
>>>Agnes
>>
>>Good to know:) Not using general fields for years.
>>Cetin
>
>I stuck with it because of this centered problem. (And that it is introduced in some database I can not change at will.) ::(
>
>Agnes
I'm a mixture of Albert Einstein and Arnold Schwarzenegger. The only trouble is that I got Einstein's body and Schwarzenegger's brain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform