简体   繁体   English

使用datasnap从clientdataset加载图像时出错[Delphi XE7,firemonkey mobile]

[英]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.

相关问题 使用firemonkey delphi Xe7在添加文件以在Android中部署时出错 - Error on Add file to deploy in Android, with firemonkey delphi Xe7 Delphi XE7 Firemonkey:如何获取设备中设置的区域设置dateformat? - Delphi XE7 Firemonkey: How to get locale dateformat set in device? 在Delphi XE7 Android Target中使用SuperObject时出错 - Error in using SuperObject in Delphi xe7 android Target 通过JNI使用Delphi从图库中获取位图,Delphi XE7失败,与Delphi XE6兼容 - Getting a bitmap from gallery using Delphi via JNI, fails with Delphi XE7, works with Delphi XE6 delphi xe7移动android中的右到左语言 - Right to Left Language in delphi xe7 Mobile android Delphi XE7 Firemonkey Android 5.1.1应用程序在三星Galaxy S7上仅通过TEdit崩溃 - Delphi XE7 Firemonkey Android 5.1.1 app crashing with just a TEdit on Samsung Galaxy S7 delphi XE7 firemonkey android共享对象/库被动态加载 - 模板 - delphi XE7 firemonkey android shared object / library to be dynamically loaded - template Delphi XE7 + FireMonkey +安卓。 该应用程序不在后台以向用户显示通知 - Delphi XE7 + FireMonkey + Android. The application is not in the background to display notifications to the user 使用Delphi xe7将文本从Windows操作系统发送到Android设备 - Send text From Windows OS to Android Device using Delphi xe7 Delphi xe7 android中的Messagedlg - Messagedlg in Delphi xe7 android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM