N
njdscb
Unregistered / Unconfirmed
GUEST, unregistred user!
用ACESS存储JPEG文件,已通过流文件,具体如下,还是提示:bitmap image is not valid.望解决。
procedure TForm1.Button3Click(Sender: TObject);
var
MyJPEG : TJPEGImage;
MS: TMemoryStream;
begin
openpicturedialog1.Execute;
MyJPEG := TJPEGImage.Create;
try
with MyJPEG do
begin
image1.Picture.LoadFromFile(openpicturedialog1.FileName);
Assign(Image1.Picture.Graphic);
MS:=TMemoryStream.create;
SaveToStream(MS);
MS.Position:=0;
adotable1.Edit;
TBlobField(adotable1.FieldbyName('a2')).LoadFromStream(MS);
adotable1.Post;
messagebox(getactivewindow(),'图像保存完毕!','保存',mb_ok);
end;
finally
MyJPEG.Free;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
MyJPEG : TJPEGImage;
MS: TMemoryStream;
begin
openpicturedialog1.Execute;
MyJPEG := TJPEGImage.Create;
try
with MyJPEG do
begin
image1.Picture.LoadFromFile(openpicturedialog1.FileName);
Assign(Image1.Picture.Graphic);
MS:=TMemoryStream.create;
SaveToStream(MS);
MS.Position:=0;
adotable1.Edit;
TBlobField(adotable1.FieldbyName('a2')).LoadFromStream(MS);
adotable1.Post;
messagebox(getactivewindow(),'图像保存完毕!','保存',mb_ok);
end;
finally
MyJPEG.Free;
end;
end;