sql - add calcfield to TQuery -


i found code create calc field tadotable in delphi somewhere ...

    .....     procedure tfrmmain.abstable1calcfields(dataset: tdataset);     begin       abstable1        fieldbyname('cost').asfloat := fieldbyname('price').asfloat *                                       fieldbyname('quantity').asinteger;        //  add new field cost price * quantity  !!!!     end;      end. 

inside app create tadoquery @ rum time

  try     fquery.sql.clear;     fquery.sql.addstrings(amemo.lines);     fquery.open;      .....          end; 

how add more calc fields query derived first code fragment ?

i think way can creating set of persistent tfields in ide (or equivalent creation of them in code before open dataset). otherwise, when call open on dataset, iirc call bindfields , - unless dataset has set of tfields - create set of dynamic tfields last long dataset open, not include calculated fields.

by time bindfields has been called, it's late add more, have set them beforehand or not @ all.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -