문제

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