J
JamesDF
Unregistered / Unconfirmed
GUEST, unregistred user!
保存到数据库中
procedure TForm1.Button1Click(Sender: TObject);
var
Pic:TMemoryStream;
begin
if OpenDialog1.Execute then
begin
Pic := TMemoryStream.Create ;
pic.LoadFromFile(Opendialog1.FileName );
pic.Position := 0;
Image1.Picture.LoadFromFile(Opendialog1.FileName);
ADOQuery1.Insert ;
ADOQuery1Pic.LoadFromStream(pic);
ADOQuery1.Post ;
end;
end;
//好像没有问题
把保存到数据库的Jpg图显示出来,代码如下
procedure TForm1.ADOQuery1AfterScroll(DataSet: TDataSet);
var
Dpic:TmemoryStream;
begin
Dpic := Tmemorystream.create;
ADOQuery1Pic.SaveToStream(DPic);
DPic.Position := 0;
Image1.Picture.Bitmap.LoadFromStream (dpic);
end;
出错提示:bitmap Image is not valid
procedure TForm1.Button1Click(Sender: TObject);
var
Pic:TMemoryStream;
begin
if OpenDialog1.Execute then
begin
Pic := TMemoryStream.Create ;
pic.LoadFromFile(Opendialog1.FileName );
pic.Position := 0;
Image1.Picture.LoadFromFile(Opendialog1.FileName);
ADOQuery1.Insert ;
ADOQuery1Pic.LoadFromStream(pic);
ADOQuery1.Post ;
end;
end;
//好像没有问题
把保存到数据库的Jpg图显示出来,代码如下
procedure TForm1.ADOQuery1AfterScroll(DataSet: TDataSet);
var
Dpic:TmemoryStream;
begin
Dpic := Tmemorystream.create;
ADOQuery1Pic.SaveToStream(DPic);
DPic.Position := 0;
Image1.Picture.Bitmap.LoadFromStream (dpic);
end;
出错提示:bitmap Image is not valid