David Lastrucci
Posted on February 19, 2024
Perché continuare a scrivere codice così:
Query.SQL.Text :=
'SELECT I.ID AS InvoiceID, I.Number, ' +
'C.ID AS CustomerID, C.Name AS CustomerName, ' +
'U.ID AS CountryID, U.Name AS CountryName ' +
'FROM Invoices AS I ' +
'INNER JOIN Customers AS C ON C.ID = I.CustomerID ' +
'INNER JOIN Countries AS U ON U.ID = C.CountryID ' +
'WHERE I.ID = :InvoiceID';
Query.ParamByName('InvoiceID').AsInteger := 1;
Query.Open;
ShowMessage(
Format('Invoice No: %d, Customer: %s, Country: %s', [
Query.FieldByName('Number').AsInteger,
Query.FieldByName('CustomerName').AsString,
Query.FieldByName('CountryName').AsString]));
Quando c'è la possibilità di scriverlo così?
LInvoice := FContext.Get<TInvoice>(1);
ShowMessage(
Format('Invoice No: %d, Customer: %s, Country: %s', [
LInvoice.Number,
LInvoice.Customer.Name,
LInvoice.Customer.Country.Name]));
Per maggiori informazioni visitail link al progetto Trysil:
💖 💪 🙅 🚩
David Lastrucci
Posted on February 19, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.