質問

I'm moving code from Delphi 2007 + AnyDac to Delphi XE4 + FireDac. In AnyDac case all empty strings were stored like NULL, and in FireDac all empty strings are stored like empty string ''.

I need to go back to NULL's. What is the best way of doing that? I store to DB using params:

ADQuery.Params.ParamByName('Code').Value :=Code;
役に立ちましたか?

解決

Include (set it to True in the Object Inspector) the StrsEmpty2Null option to the FormatOptions of your dataset object. The reference says (emphasized by me):

Controls the conversion of zero-length string values to NULL value. Use the StrsEmpty2Null property to control whether FireDAC should convert string values with zero length to NULL value (True) or not (False). The default value is False.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top