Jump to content

William23668

Members
  • Content Count

    121
  • Joined

  • Last visited

Posts posted by William23668


  1. I tried to follow the steps as per embarcadero tutorial like that:

    > pip install delphivcl
    Collecting delphivcl
      Using cached delphivcl-0.1.24-cp311-cp311-win_amd64.whl
    Installing collected packages: delphivcl
    Successfully installed delphivcl-0.1.24
    
    > Python
    Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from delphivcl import *
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Program Files\Python311\Lib\site-packages\delphivcl\__init__.py", line 22, in <module>
        package = new_import()
                  ^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\delphivcl\__init__.py", line 15, in new_import
        ld = loader.create_module(spec)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    ImportError: DLL load failed while importing DelphiVCL: The specified module could not be found.

    What is the problem ?


  2. 18 minutes ago, limelect said:

    1.use FDConnection1

    2.FDConnection1BeforeConnect  >>>>FDConnection1.Params.Values['Database'] := 'Applications.db';

    3. FDConnection1AfterConnect>>>>

     FDConnection1.ExecSQL('CREATE TABLE IF NOT EXISTS Files (SectionsId INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,MainDirectory TEXT NULL, Files TEXT NULL)');
      FilesFDTable.TableName := 'Files';
      FilesFDTable.Active := True;
     Now you can use table or sql

     

    I dont understand !! the code display error on connect so it does not connect or create a file.


  3. Hi

     

    I am using this code to create the database bute I get error on connect :


     

    var
     MyDBFile: string;
    begin
      MyDBFile := 'C:\db5.sqlite3';
    
      if FileExists(MyDBFile) then
        DeleteFile(MyDBFile);
    
      FDConnection1.Params.Values['Database'] := MyDBFile;
      FDConnection1.Params.Values['DriverID'] := 'SQLite';
      //Connection.Params.Values['Encrypt']  := 'aes-128';
      //Connection.Params.Values['Password'] := '1234';
      FDConnection1.Connected := True;
    
    
    
    ---------------------------
    [FireDAC][Phys][SQLite] ERROR: unable to open database file.
    ---------------------------
    

     


  4. Hi

     

    I was able to read the file byte by byte but the app hangup/not responding I dont know why ? Here is the code:

     

     

    var
      AFile: TFileStream;
      BR: TBinaryReader;
      MyByteArray: TBytes;
      mstr: String;
      i: integer;
    begin
      AFile := TFileStream.Create(filename, fmOpenRead);
      BR := TBinaryReader.Create(AFile, TEncoding.Unicode, false);
      try
        SetLength(MyByteArray, AFile.Size);
    
        // Get the whole file contents into the byte array
        MyByteArray := BR.ReadBytes(AFile.Size);
    
        for i := low(MyByteArray) to High(MyByteArray) do begin
          SetString(mstr, PAnsiChar(@MyByteArray[i]), Length(MyByteArray));
          RichEdit1.Text := RichEdit1.Text + mstr;
        end;
    
        BR.Close;
      finally
    
        BR.Free;
        AFile.Free;
      end;
    end;

     


  5. 6 minutes ago, David Heffernan said:

    The size of the file is AFile.Size. You read the entire file into a byte array, but then go at the same stream with a binary reader. There are so many mistakes here. Do you want to read it into a byte array and covert to string. Or do you want to read it as binary. 

    read it as binary. I will want to store it into sqlite database later.

×