Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 29.05.07 08:27 
ich will ein (jpg) bild aus einer access Datenbank auslesen
ich hab das versucht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var s:String;p:TPicture;
begin
ADOQuery1.Active:=false;
  ADOQuery1.Sql.Clear;
  ADOQuery1.Sql.Add('SELECT Bild FROM table where Bild<>''''');
  ADOQuery1.Active:=true;
  P := TPicture.Create;
  P.Assign(TBLOBField(ADOQuery1.Fields[0]));
  p.Free;
end;

Aber der meint blos: "ungültige Bitmap"
was kann ich amchen?
Manina
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44

Win 7 Pro
RAD Studio 2010 Pro
BeitragVerfasst: Di 29.05.07 09:45 
bei mir funzt folgendes:

Bild in Datenbank ist vom Typ TImage (allerdings SQL-Server, nicht Access)

beim Schreiben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var jpg : TJPEGImage;

jpg.LoadFromFile('xxx.jpg');
ADOQuery.Edit;
ADOQuery.Fields[i].AsVariant := jpg;
ADOQuery.Post;


beim Lesen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var jpg : TJPEGImage;
    bmp : TBitmap;

if ADOQuery.Fields[i].AsVariant <> NULL then begin
  jpg.Assign(ADOQuery.Fields[i]);
  bmp.Assign(jpg);
end;


Hilft Dir das ? :?:

_________________
Gates, oder Gates nicht ?
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 29.05.07 10:09 
es klappt super! DANKE