//******保存图片开始***********
query.close;
query.sql.clear;
query.sql.add('delete from gydpicture where (bm=''' + curbm + ''') and (hyh=''' + hyh_edit.text + ''') and (hh=''' + hh_edit.text + ''')and (yplx=''' + yplx_edit.text + ''')');
query.ExecSQL;
if image1.Picture.Graphic <> nil then
begin
ADOQuery2.close;
ADOQuery2.sql.clear;
ADOQuery2.sql.add('insert into gydpicture(bm,hyh,hh,yplx,picture) values(''' + curbm + ''',''' + hyh_edit.text + ''',''' + hh_edit.text + ''',''' + yplx_edit.text + ''',
icture)');
if image1.Picture.Graphic <> nil then
begin
try
mys := TMemoryStream.create;
Image1.picture.Graphic.SaveToStream(mys);
ADOQuery2.Parameters[0].LoadFromStream(mys, ftblob);
finally
mys.Free;
end;
end
else
begin
ADOQuery2.Parameters[0].value:='';
end;
ADOQuery2.ExecSQL;
end;
//******保存图片结束***********
//**********调出图片开始********************
adoquery1.Close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from gydpicture where (bm=''' + curbm + ''') and (hyh=''' + hyh_edit.text + ''') and (hh=''' + hh_edit.text + ''')and (yplx=''' + yplx_edit.text + ''')');
adoquery1.open;
if not adoquery1.IsEmpty then
begin
try
jpgpic := Tjpegimage.Create;
mys := TmemoryStream.Create;
tblobfield(adoquery1.fieldbyname('picture')).SaveToStream(mys);
mys.Position := 0;
jpgpic.LoadFromStream(mys);
image1.Picture.Graphic := jpgpic;
ifjpg := true;
except
try
image1.Picture.Bitmap.Assign(adoquery1.FieldByName('picture'));
ifjpg := false;
except
image1.Picture.Bitmap := nil;
end;
end;
Image1.width := Image1.Picture.width;
Image1.height := Image1.Picture.height;
end
else
image1.Picture.Bitmap := nil;
//*******调出图处结束********