Enums vs Const vs Class Const in Delphi programming

后端 未结 6 1901
长情又很酷
长情又很酷 2021-02-19 06:31

I have an integer field in a ClientDataSet and I need to compare to some values, something like this:

I can use const

const
  mvValue1 = 1;
  mvValue2 =          


        
6条回答
  •  我在风中等你
    2021-02-19 07:07

    An option you haven't thought of is to use a lookup table in the database and then you can check against the string in the database.

    eg.

     Select value, Description from tbl_values inner join tbl_lookup_values where tbl_values.Value = tbl_lookup_values.value
    
    if ClientDataSet_Field.AsString = 'ValueIwant' then
    

提交回复
热议问题