ht99的方法可以,关键是使用Table建立二进制字段的字段对象,
利用二进制字段对象提供的方法把数据存到数据库中。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Db, DBTables;
type
TForm1 = class(TForm)
Table1: TTable;
Table1Remarks: TMemoField;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
ms: TMemoryStream;
begin
ms: TMemoryStream.Create;
ms.LoadFromFile('c:/aa.bmp');
Table1Remarks.LoadFromStream(ms);
ms.Free;
end;
end.