delphi操作blobfield
delphi操作blobfield
procedure TForm2.Button1Click(Sender: TObject); begin var Stream:TMemoryStream := TMemoryStream.Create; img1.Picture.Graphic.SaveToStream(Stream); dataset.Close; dataset.SQL.Clear; dataset.SQL.Text := 'insert into t1 (picture) values (:picture)'; dataset.ParamByName('picture').LoadFromStream(Stream, ftBlob); dataset.ExecSQL; Stream.Free; end; procedure TForm2.Button2Click(Sender: TObject); begin var Stream: TMemoryStream :=TMemoryStream.Create ; var jpg: TjpegImage := TjpegImage.Create ; TBlobField(dataset.FieldByName('picture')).SaveToStream(Stream); Stream.Position :=0; jpg.LoadFromStream(Stream); img1.Picture.Assign(Jpg); Stream.Free; Jpg.Free; end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/16445169.html