Reputation: 18221
I was using AsWideString to pass Unicode string to TADQuery parameter.
ADQuery.Params.ParamByName('MyFld').AsWideString
But when string becomes too long I got error:
[MyFld]. Max len = [8002], actual len = [10522]
Then I decided to use AsMemo property
ADQuery.Params.ParamByName('MyFld').AsMemo
In this case my Unicode string is not displayed correctly.
What is the way to solve both problems?
Upvotes: 5
Views: 2739
Reputation: 361
The TFDParam type has an .AsWideMemo in XE5 that should accept unicode characters correctly and get around the size limitation you encountered.
ADQuery.Params.ParamByName('MyFld').AsWideMemo := 'Some unicode string';
Upvotes: 5
Reputation: 597941
The actual database field has a max character limit assigned to it. You cannot set a value that exceeds that limit. It will either truncate the value, or in your case, raise an error. You cannot use AsMemo
to set a non-Memo field. Keep using AsWideString
and pay attention to your database layout.
Upvotes: 4