і
Delphi
code posted
created at 20 May 11:29
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
uses ... jpeg; type ... procedure ReadImgFromDB(); procedure LoadImgToDB(); procedure TForm1.ReadImgFromDB(); var jpg:TJPEGImage; Blob:TMemoryStream; begin try jpg:=TJPEGImage.Create; Blob:=TADOBlobStream.Create(TBlobField(DM.tblAnteny.FieldByName('Oioi')),bmRead); if Blob.Size = 0 then Exit; jpg.LoadFromStream(Blob); img1.Picture.Assign(jpg); jpg.Free; Blob.Free; except on e:Exception do begin jpg.Free; Blob.Free; end; end; end; procedure TForm1.LoadImgToDB(); var Blob:TMemoryStream; begin try if dlgOpen1.Execute then begin DM.tblAnteny.Edit; Blob:=TADOBlobStream.Create(TBlobField(DM.tblAnteny.FieldByName('Oioi')),bmWrite); Blob.LoadFromFile(dlgOpen1.FileName); Blob.Free; DM.tblAnteny.Post; end; except on e:Exception do end; end; |
945 Bytes in 5 ms with coderay