4

我正在使用 AsWideString 将 Unicode 字符串传递给 TADQuery 参数。

ADQuery.Params.ParamByName('MyFld').AsWideString

但是当字符串变得太长时,我得到了错误:

[MyFld]. Max len = [8002], actual len = [10522]

然后我决定使用 AsMemo 属性

ADQuery.Params.ParamByName('MyFld').AsMemo

在这种情况下,我的 Unicode 字符串无法正确显示。

解决这两个问题的方法是什么?

4

2 回答 2

4

XE5 中的 TFDParam 类型有一个 .AsWideMemo ,它应该正确接受 unicode 字符并绕过您遇到的大小限制。

ADQuery.Params.ParamByName('MyFld').AsWideMemo := 'Some unicode string';
于 2014-03-04T19:45:20.243 回答
3

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.

于 2014-01-28T10:00:28.543 回答