数据库图片存储也读取

procedure TForm1.Button1Click(Sender: TObject);
var
Ms:TmemoryStream;
jpg:Tjpegimage;
begin
ms:=TmemoryStream.Create;
Image1.Picture.Graphic.SaveToStream(Ms);
Ms.Position :=0;
DATA_M.ADOQuery_TEMP.Active:=FALSE;
DATA_M.ADOQuery_TEMP.SQL.Add('SELECT * FROM JZ_JZGIMG')  ;
DATA_M.ADOQuery_TEMP.Active:=TRUE;
DATA_M.ADOQuery_TEMP.Edit;
TBlobField(DATA_M.ADOQuery_TEMP.FieldByName('ZP')).LoadFromStream(Ms);
DATA_M.ADOQuery_TEMP.Post;
Ms.Free ;

end;

posted on 2014-07-21 20:54  martian6125  阅读(99)  评论(0编辑  收藏  举报