procedure TForm1.Button1Click(Sender: TObject);
var
myPicture:TJPEGImage;
mem:TMemoryStream;
begin
mem:=TMemoryStream.Create;
myPicture:=TJPEGImage.Create;
if(OpenDialog1.Execute()) then
begin
mem.LoadFromFile(OpenDialog1.FileName);
myPicture.LoadFromFile(OpenDialog1.FileName);
myPicture.SaveToStream(mem);
with ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('insert into imagetest (imgid,imgsize) values(1,"+mem+")');
// TBlobField(ADOQuery1.FieldByName('imgsize')).SaveToStream(mem);
ExecSQL;
end;
mypicture.Free;
mem.Free;
end;
end;
其中myPicture.LoadFromFile(OpenDialog1.FileName);
myPicture.SaveToStream(mem);
是想将用OpenDialog打开的图片二进制流存入变量mem中,但运行时mem为空,求各位大虾帮忙
------解决方案--------------------------------------------------------
这是delphi,不是delphi.net,还是去开发语言-delphi问吧。