Jump to content

haentschman

Members
  • Content Count

    217
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by haentschman


  1. Hi...😎

    Quote

    I must have an id field.... 

    ...always! Per table or better per database. 😉 Per database = the ID is complete unique.

     

    id varchar(10) not null primary key,

    ... never string!

     

    ID int not null primary key,

     


  2. Hi...welcome here. :classic_cheerleader:

     

    First:

    Quote

    data to an Access database

    ...why ACCESS and ADO? 🤢 ...😉

     

    For the future: can you change the database? 😉

     

    const ISQL = 'INSERT INTO JobCard (ID ,OrderNo ,JobName)  VALUES ( :ID :OrderNo, :JobName)';

    ...better than the ADD orgy. It is even better to store the SQL outside the "form" or "datamodule" as SQL file. 😉

    Quote

    I am a newbie

    ...i know. No problem. Learning by doing... 😉


  3. Quote

    On 11/3/2021 at 9:00 AM, Daniel said:  I gave the whole project to another MVP, I will ask about the progress.

    Two month...What is the status? Which MVP?

    Quote

    at the moment it's the adaption to the high-dpi settings

    Imho 10% uses high-dpi. :classic_huh:

    Quote

    The code itself works

     ...make a version without high-dpi. All waiting! Please...:classic_cheerleader:

     

    PS: why don't you publish it on github or something...?


  4. 👍

     

    Remember: sometimes it is required to load the complete project, including DPR, DFM...then the ZIP format is your choice. :classic_cool:

     

    Background:  if the external server is closed, the thread here is incomplete. :classic_huh:


  5. Hi...:classic_cool:

    Quote

    In the end, we changed to use MySql

    ...why? :classic_huh: Why do you want to possibly fall into the license trap? :classic_unsure:

     

    https://searchitchannel.techtarget.com/feature/Using-MySQL-licensing-Open-source-license-vs-commercial-license

    https://www.mysql.com/de/products/

     

    or

     

    MyDAC / UniDAC without loading libmysql.dll (the dll is the problem)

     

    info in german: https://entwickler-ecke.de/topic_libmysqldll+lizenz_68186,0.html

     

    totally free databases: Firebird, PostgreSQL ...

     

    :classic_wink:

     

     

  6. Locate


    :classic_tongue: Gladly...but the most important thing is not to resolve the variable in debugging mode.

    FieldByName(Column).Value

    ...at the breakpoint...the debugger says:  Value = ??? :classic_sad:


  7. Quote

    Contrary, I changed all of my "SQL.Add(s)" to "SQL.Text := s". Even if I construct query conditionally, I collect it first as variable and then assign it to SQL.

    advertising :classic_tongue:

     

    This is another way to manage SQL statements. The SQL are stored in separate files in a folder structure in the project. SQL can be tested in the preferred DBMS editor. 

    Important: SQL Statements OUTSIDE of the Sourcecode (pas, dfm) in resources *.res. (without SQL.Add; SQL.Add; SQL.Add... :classic_cool:) 

     

     

    image.thumb.png.61d109fede274a617a5521311ae0d2e4.png

     

    Example:

    ...only 1 line for complete SQL.Text. :classic_cool:

    function TDatabase.CreateDocument(Path: string): TDocument;
    var
      Qry: TFDQuery;
      Document: TDocument;
    
      procedure FillDocument;
      begin
        // ! Achtung Reihenfolge wegen Properties die aus Vorhergehenden ermittelt werden
        Document := TDocument.Create;
        Document.State := sdsNormal;
        Document.ID := Qry.FieldByName('ID').AsInteger;
    
        Document.AddDate := Qry.FieldByName('AddDate').AsDateTime;
        Document.AddName := Qry.FieldByName('AddName').AsString;
        Document.AddYear := YearOf(Document.AddDate);
        Document.DocumentGroupString := Qry.FieldByName('DocumentGroupString').AsString;
        Document.DocumentTypeString := Qry.FieldByName('DocumentTypeString').AsString;
        Document.DocumentCaption := Qry.FieldByName('DocumentCaption').AsString;
        Document.DocumentChoice := TSEAMTools.GetDocumentChoiceType(Document.DocumentTypeString);
        Document.SendTypeFolder := Boolean(Qry.FieldByName('SendTypeFolder').AsInteger);
        Document.SendTypeUSB := Boolean(Qry.FieldByName('SendTypeUSB').AsInteger);
        Document.SendTypeMail := Boolean(Qry.FieldByName('SendTypeMail').AsInteger);
        Document.ReceiptDate := Qry.FieldByName('ReceiptDate').AsDateTime;
        Document.ServiceDate := Qry.FieldByName('ServiceDate').AsDateTime;
        Document.ReceiptNumber := Qry.FieldByName('ReceiptNumber').AsString;
        Document.ReceiptReceiver := Qry.FieldByName('ReceiptReceiver').AsString;
        Document.ReceiverReceiverName := Qry.FieldByName('ReceiverReceiverName').AsString;
        Document.Store := Qry.FieldByName('Store').AsString;
        Document.StoreName := Qry.FieldByName('StoreName').AsString;
        Document.StoreName_1 := Qry.FieldByName('StoreName_1').AsString;
        Document.StoreCountry := Qry.FieldByName('StoreCountry').AsString;
        Document.StorePostCode := Qry.FieldByName('StorePostCode').AsString;
        Document.StoreLocation := Qry.FieldByName('StoreLocation').AsString;
        Document.StoreStreet := Qry.FieldByName('StoreStreet').AsString;
        Document.ServicePartner := Qry.FieldByName('ServicePartner').AsString;
        Document.ModifiedDate := Qry.FieldByName('ModifiedDate').AsDateTime;
        Document.ModifiedName := Qry.FieldByName('ModifiedName').AsString;
    
        Document.OriginalFileName := Qry.FieldByName('OriginalFileName').AsString; // als Letztes wegen Setter
        Document.DocumentLocation := TTools.GetDocumentLocationType(Document.OriginalFileName);
    
        Result := Document;
      end;
    
    begin
      Result := nil;
    
      Qry := CreateQuery;
      try
        // Pfad
        Qry.SQL.Text := GetSQLByName('SEAM_DOCUMENT_SELECT_PATH');
        Qry.ParamByName('FIN').AsString := Path;
        Qry.Open;
    
        if Qry.Eof then
        begin
          // Belegnummer
          Qry.SQL.Text := GetSQLByName('SEAM_DOCUMENT_SELECT_RECEIPT_NUMBER');
          Qry.ParamByName('REN').AsString := TToolsRegex.ExtractReceiptNumber(Path).Value;
          Qry.Open;
    
          if not Qry.Eof then
          begin
            FillDocument;
          end;
        end
        else
        begin
          FillDocument;
        end;
      finally
        Qry.Free;
      end;
    end;

    image.thumb.png.02dee68656c6d080c438e5e619d35d87.png

×