App crashes when create create in Datamodule

0

I'm creating an Android application in delphiXE7 and everything works until I'm going to dynamically create the datamodule. Then he hangs up and does not come back.

procedure TForm1.Btn1Click(Sender: TObject);
var M:TModalResult;
begin
Application.CreateForm(TDataModule1, DataModule1);
end;

I had to do this dynamic create because before, when it automatically created the application it only got a black screen and did not start.

Remembering that you can not even execute this code in the BeforeConnection of TFDConnection;

{$IF DEFINED (IOS) || (ANDROID)}
DataModule1.Conn1.Params.Values['DriverID'] := 'SQLite';
try
DataModule2.Conn1.Params.Values['Database']:= TPath.Combine(TPath.GetDocumentsPath, 'Banco002.SQLite');
DataModule2.Conn1.Connected := True;
      except on E: Exception do
      begin
        raise Exception.Create('Erro de conexão com o banco de dados!');
      end;
{$ENDIF}

Has anyone ever had this problem? Use delphi Xe7, sqlite, Android 4.2 Samsung DUOS Smartphone and updated SDK.

    
asked by anonymous 12.01.2017 / 15:16

1 answer

1

I was able to identify the problem. While testing the APP in designtime, I forgot an open table and, as the mobile path of the bank was different, then the application crashed, as I was looking for the bank ates of the method

{$IF DEFINED (IOS) || (ANDROID)}
DataModule1.Conn1.Params.Values['DriverID'] := 'SQLite';
try
DataModule2.Conn1.Params.Values['Database']:= TPath.Combine(TPath.GetDocumentsPath, 'Banco002.SQLite');
DataModule2.Conn1.Connected := True;
      except on E: Exception do
      begin
        raise Exception.Create('Erro de conexão com o banco de dados!');
      end;
{$ENDIF}
    
25.01.2017 / 04:47