Jump to content

DrShepard

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by DrShepard


  1. Hello!

    I am trying to execute multiple SQL statements at once in an anonymous block of code. I am using FireDAC and Postgres database. When I set the parameters, I get an error on execution: 'Parameter 'p_val1' not found'

    https://pastebin.com/dPRB8T3d

    I tried TFDСommand and TFDScript objects, but it didn't help. What am I doing wrong?


  2. On 2/9/2021 at 9:22 PM, Attila Kovacs said:

    @Rollo62 right, libreoffice can convert 

     

    
    "C:\Program Files\LibreOffice\program\soffice.exe" --convert-to xlsx "C:\input_path\file.xls" -outdir "C:\output_path"

    This method doesn't work in cycle.

     

    uses
      Winapi.Windows,
      Winapi.ShellApi,
      System.SysUtils;
    
    var
      Command: PWideChar;
      SearchRec: TSearchRec;
      XLSdir, XLSXdir: string;
    
    begin
      try
        XLSdir  := ExtractFilePath(ParamStr(0)) + 'xls';
        XLSXdir := ExtractFilePath(ParamStr(0)) + 'xlsx';
    
        if FindFirst(XLSdir + '\*.xls',  faAnyFile, SearchRec) = 0 then
          repeat
            if (SearchRec.Name = '.') or (SearchRec.Name = '..') then
              continue;
    
            WriteLn(SearchRec.Name);
            Command := PChar('/c ""C:\Program Files\LibreOffice\program\soffice.exe" --convert-to xlsx "' + XLSdir + '\' + SearchRec.Name + '" -outdir "' + XLSXdir + '""');
            ShellExecute(GetModuleHandle(nil), 'open', 'cmd.exe', Command, nil, SW_HIDE);
            Sleep(1000);
    
          until FindNext(SearchRec) <> 0;
    
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    
      Write(#13#10 + 'press any key to continue...');
      ReadLn;
    end.

     

    image.thumb.png.c13efe9bf99f229ea741938c2bb0618a.png


  3. Hello! I need to make hint appears in OnKeyPress event like in NumbersOnly-property (see attach). Because I use another input logic (not only numbers, but some special symbols too). I know that hint message is generated by Windows itself. What should I do? 

     

    hint2.png

×