急求,如向数据库中导入图片格式的记录(200分)

  • 主题发起人 主题发起人 royhgf
  • 开始时间 开始时间
R

royhgf

Unregistered / Unconfirmed
GUEST, unregistred user!
急求,如向数据库中导入图片格式的记录,我用的是DB的数据库,保存图片的字段类型为Graphic,用DBImage怎样实现。请给出具体的代码。
 
var<br>&nbsp; &nbsp; JPEGImage: TJpegImage;<br>&nbsp; &nbsp; Stream: TMemoryStream;<br>&nbsp; begin<br>&nbsp; &nbsp; &nbsp; JPEGImage := TJpegImage.Create;<br>&nbsp; &nbsp; &nbsp; Stream := TMemoryStream.Create;<br>&nbsp; &nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; &nbsp; JPEGImage.Assign(Bmp);<br>&nbsp; &nbsp; &nbsp; &nbsp; Stream.Clear;<br>&nbsp; &nbsp; &nbsp; &nbsp; JPEGImage.SaveToStream(Stream);<br>&nbsp; &nbsp; &nbsp; &nbsp; TBlobField(Field).LoadFromStream(Stream);<br>&nbsp; &nbsp; &nbsp; finally<br>&nbsp; &nbsp; &nbsp; &nbsp; JPEGImage.Free;<br>&nbsp; &nbsp; &nbsp; &nbsp; Stream.Free;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;
 
解决数据库中图片的问题,关键技术如下:<br>http://www.delphibbs.com/keylife/iblog_show.asp?xid=27546
 

Similar threads

后退
顶部