if OpenDialog1.Execute then
begin
if OpenDialog1.FileName = '' then Exit;
FileName := OpenDialog1.FileName;
Mem := TMemoryStream.Create;
Mem.LoadFromFile(FileName);
Mem.Seek(0,soFromBeginning);
Query1.Close;
Query1.DatabaseName := 'D:/BLOB';
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('INSERT INTO BLOBNAME(NAME,FILENAMES) VALUESNAME,:FILENAMES)');
Query1.ParamByName('Name').AsString := FileName;
Query1.ParamByName('FileNAMES').LoadFromStream(Mem,ftBlob);
Query1.ExecSQL;
Mem.Free;
end;
var
f:TFileStream;
b:TBlobStream;
begin
b:=TBlobStream.Create(Table1.Fields[0] as TBlobField,bmWrite);
f:=TFileStream.Create(FileName,fmOpenRead);
try
b.CopyFrom(f,f.Size);
finally
b.Free;
f.Free;
end;
end;