[英]Error loading image from clientdataset using datasnap [Delphi XE7, firemonkey mobile]
I am using Delphi XE7, Firemonkey Mobile. 我正在使用Delmon XE7,Firemonkey Mobile。 Tried both on W32 as well as my Nexus4 (Android 4.4.4). 在W32和我的Nexus4(Android 4.4.4)上都进行了尝试。
Problem: when loading an image from the clientdataset I get the following errors 1. Remote error: [FireDAC]{Phys][fB]-306. 问题:从clientdataset加载图像时,出现以下错误1.远程错误:[FireDAC] {Phys] [fB] -306。 Command text must not be empty. 命令文本不能为空。 (Connection) 2. Socket Error, even though the CDS does already contain the data (No connection) (连接)2.套接字错误,即使CDS已经包含数据(无连接)
Firebird DB --> Firedac --> Datasnap [server] --> DBX connection --> DSProviderconnection --> Clientdatasets Firebird DB-> Firedac-> Datasnap [服务器]-> DBX连接-> DSProviderconnection-> Clientdatasets
The datasetprovider on the server has the following options set: - poFetchBlobsOnDemand - poAllowCommandText 服务器上的数据集提供程序设置了以下选项:-poFetchBlobsOnDemand-poAllowCommandText
The loaded field is indeed a blob field and does contain data. 加载的字段确实是blob字段,并且确实包含数据。
if DM_OD.CDS_QEmballage.FieldByName('AFBEELDING').IsBlob then
begin
if DM_OD.CDS_QEmballage.FieldByName('AFBEELDING').IsNull then
begin
showmessage('Empty!'); //for testing puropses
end
else
begin
try
BF := DM_OD.CDS_QEmballage.FieldByName('AFBEELDING') as TBlobfield;
BS := DM_OD.CDS_QEmballage.CreateBlobStream(BF, bmRead); //error message
self.Items[i].EmbalPic.LoadFromStream(BS);
finally
BS.Free;
end;
end;
end;
Try this: 尝试这个:
var
ms: TMemoryStream;
begin
ms := TMemoryStream.Create;
try
TBlobField( DM_OD.CDS_QEmballage.FieldByName('AFBEELDING') ).SaveToStream( ms );
self.Items[i].EmbalPic.LoadFromStream( ms );
finally
ms.Free;
end;
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.