자유롭게 질의 및 응답을 할 수 있는 게시판입니다. 개발자 여러분의 답변이 큰 도움이 됩니다. 
  • 제품설치/등록 오류 문의: 설치/등록 Q&A 이용 (제품 구매 고객 한정)

본 게시판은 개발자들이 자유롭게 질문과 답변을 공유하는 게시판입니다.
* 따라서 최대한 정중하게 질문을 올려 주세요.
* 질문을 상세히 작성해 주실 수록 좋은 답변이 올라 옵니다.
* 다른 분들도 참고할 수 있도록 결과 댓글 필수(또는 감사 댓글)
(결과 댓글을 달지 않는 경우 다음 질문에 대한 답변이 달리지 않는 불이익이 있을 수 있습니다.)
-----------------------------------------------------------------------------------------------

XE10.4를 사용하여 이미지컴퍼넌트로 작성한 이미지를

서버로 전송하는 방법에 어떤 무제가 있을까요?

 

프로그램은

모바일에서 image1에 싸인 받아서  MSSQL서버로 저장하려하는 겁니다

모바일에서 image1에 싸인을 받는것은 성공했는데 이것을 datasnap을 이용헤서 서버로 전송하는

부분에 에러가 납니다

 

1) 저장화면의 이미지를 넘기는 방업이 잘못된건지?

2) data모듈쪽에서 서버로 넘기는 부분의 이미지control이 잘못된건지 모르겠습니다.

 

--------- 저장화면----------------------

procedure TForm2.Button3Click(Sender: TObject);

var

  ImgStream : TMemoryStream;

begin

try

ImgStream := TMemoryStream.Create;

Image1.Bitmap.SaveToStream(ImgStream);

ImgStream.Position := 0;

if SQLConnection1.connected = false then

   SQLConnection1.connected:=true;

Method := TServerMethods1Client.Create(SqlConnection1.DBXConnection);

Method.RVArea( 0,0, ImgStream);

Method.Free;

SQLConnection1.connected:=false;

 

Finally

  ImgStream.free;

End;

end;

 
-------- data모듈 ---------
procedure TServerMethods1Client.RVArea( i1: Integer; i2: Integer;  img: TMemoryStream);
begin
 
  if FDataQueryAreaCommand = nil then
  begin
    FDataQueryAreaCommand             := FDBXConnection.CreateCommand;
    FDataQueryAreaCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FDataQueryAreaCommand.Text        := 'TServerMethods1.RVArea';
    FDataQueryAreaCommand.Prepare;
  end;
 
  FDataQueryAreaCommand.Parameters[0].Value.SetInt32(i1);
  FDataQueryAreaCommand.Parameters[1].Value.SetInt32(i1);
  FDataQueryAreaCommand.Parameters[2].Value.SetStream(img, FInstanceOwner);
  FDataQueryAreaCommand.ExecuteUpdate; <--- 요기 실행할때 "Remote error:Invalid class typecast"
                                                                에러가 나면서 서버쪽으로 못넘깁니다
 
end;
--------  서버쪽 -------------
procedure TServerMethods1.RVArea( i1: Integer;  i2: Integer;  img: TMemoryStream);
begin
 
  exit;  -- 여기까지도 오지 않습니다
      FDQuery2.close;
      FDQuery2.sql.clear;
      FDQuery2.SQL.Add(' insert into ....... ');
      FDQuery2.ParamByName('psign').LoadFromStream(img, ftBlob );
end;