我使用的是Delphi 7和FibPlus组件。其中一个是TpFIBQuery。
我正在用泛型从表中加载数据。
select * from TableName where Key = 1返回的字段之一为BLOB(Text)类型。
我似乎无法使用以下三种方法之一将该值输入字符串列表informatie:
Informatie.Text := FieldByName('Informatie').AsString // Returns the string 'BLOB'
Informatie.Text := BlobAsString('Informatie') // Returns ''
BlobToStrings('Informatie',Informatie) // Returns ''我已经使用确认表中的字段确实包含保存的文本。
有人吗?
发布于 2012-03-24 02:50:29
通常,我喜欢这个
var
sl: TStrings; // blob IS NOT string!
ms: TMemoryStream;
begin
sl := TStringList.Create;
ms := TMemoryStream.Create;
try
q.FieldByName('x').SaveToStream(ms);
ms.Position := 0;
sl.LoadFromStream(ms);
// do what ever you want with sl here
// and here too
finally
sl.Free;
ms.Free;
end; // try..finally
end;注意,Q是您的TpFibQuery对象。此外,从表中选择*也是不好的做法。这个习惯最终会让你头痛不已。
发布于 2012-03-24 06:28:08
在尝试了产生同样错误的“江”的解决方案之后,我终于找到了罪魁祸首。
原来这是因为我的部分错误(通常是,你只需要找到它)。
结果,在处理/读取原始查询字段期间,将读取事务设置为False。
False。显然,我需要在读取操作开始时将读取事务设置为True,并在所有读取事务之后将其设置为False。这是将Paradox BDE应用程序转换为Sqlserver应用程序的Firebird时的主要更改。
无论如何,我很高兴我找到了解决办法。希望它也能帮助其他人。
https://stackoverflow.com/questions/9844110
复制相似问题