I'm using an MS SQL database to store large files in a table. The files are too large for binding to a field directly. It has to go through a command just like the update to get it into the database. No exception is raised but the function returns false. I am finding it difficult to find an answer with Google search. Any help would be apprciated.
RIMSDBFireDac.StartTransaction;
try
with DCaseAttach do
begin
FireDacQuery.SQL.Text := 'SELECT :p = ''D:\TEMP\TEMP.MP4'' FROM caseattach WHERE id = :id';
FireDacQuery.Params[0].DataType := ftStream;
FireDacQuery.Params[0].FDDataType := dtHBFile;
FireDacQuery.Params[0].ParamType := ptOutput;
FireDacQuery.Params[0].StreamMode := smOpenRead;
FireDacQuery.Params[1].AsInteger := CaseN;
if FireDacQuery.OpenOrExecute then
FireDacQuery.Params[0].AsStream.Read(Buffer, AttachSize)
else
ErrorMsg('OpenOrExecute failed.');
end;
RIMSDBFireDac.Commit;
except
on E: Exception do
begin
ErrorMsg('<PullImageFromDB on pulling photo> ' + E.Message);
RIMSDBFireDac.Rollback;
end;
end;