How can I add fields to a clientdataset at runtime?

前端 未结 5 2005
盖世英雄少女心
盖世英雄少女心 2021-01-04 18:05

I have a TClientDataSet, which is provided by a TTable’s dataset. The dataset has two fields: postalcode (string, 5) and street (string, 20)

<
5条回答
  •  隐瞒了意图╮
    2021-01-04 18:36

    Well i found a simpler solution, as i have 24 fields in my sql i didnt wanted to add them all manually so i added a dummy field to the sql statement instead like:

    select '      ' as city, the rest of the fields ... 
    

    which i can modify in my program OnAfterOpen event.

    Well i had to define in the sql how long that field should be by leaving enough empty spaces, for instance 5 empty spaces for 5 characters, so i must know how long the city name could be.

提交回复
热议问题