Icon View Incident Report

Minor Minor
Reported By: George Patena
Reported On: 7/22/2004
For: Version 4.08 Build 1
# 1792 TDBISAMParam SaveToFile Method Does Not Work If Destination File Does Not Exist

I am trying to duplicate some of my AstaServer routines in dbIsamServer.I have created several procedures in the dbIsamserver and all works well, but I am stuck on this one, fetching any file from server and saving on client app. Here's my code to retrieve from the RemoteParams and save it, but it does not work.

try
  SessionX.RemoteParams.ParamByName('fileblob').SaveToFile(
       extractfilepath(application.ExeName)+'somefile.exe');
  showmessage('save success')
except
  showmessage('save failed');
end;

Workaround:

var  Datstream : TMemorySTream; s : string
begin
  s:='somepath\somefile.exe';
   DatStream:=TMemorySTream.Create;
   dbses.RemoteParams.ParamByName('fileblob').SaveToStream(DatStream);
   DatStream.SaveToFile(s);
   DatStream.Free;
end.



Comments Comments and Workarounds
The SaveToFile method was trying to open the destination file with the fmReadWrite flag instead of the fmCreate flag. The workaround is to save the file manually using a stream.


Resolution Resolution
Fixed Problem on 7/26/2004 in version 4.09 build 1
Image