can't connect LocalData Adapters to Schemas

47 Views Asked by At

This is My Situation

I have a Service Named BaseDataService, in here I create a LocalDataAdapter that I'm gonna use to connect to a specific service called DataBaseLayer. The service I'm trying to connect contains the schemas that have all datatables needed to use.

Then I create a another service that descends from BaseDataService, so it contains the LocalDataAdapter mentioned earlier. The problem is that after configuring the local data adapter I can't open the datatables that are in the DataBaseLayer service. Posting the code:

 Procedure TBaseDataService.ConnectDatabaseLayerToAdapter
 begin
   DataBaseLayerAdapter.ServiceInstance := DatabaseLayerService as IDataAbstractLocalServiceAccess
 end

 Procedure TBaseDataService.DataAbstractServiceCreate(Sender: TObject);
 begin
   DataBaseLayerAdapter.ServiceName := ' ';
 end

 function TBaseDataService.GetDataBaseLayerService: IDataBaseLayerService;
 begin
   if not Assigned(FDatabaseLayerService) then
     FDataBaseLayerService := (CreateAndConnectService('DataBaseLayerService') as IDataBaseLayerService);
   Result := FDataBaseLayerService;
 end


   ConnectDataBaseLayerToAdapter;
   tbl_SA_Receipts.Open;

Note: The last part is where I try to connect to DataBaseLayerService.

At first I got this error:

"An exception was Raised on the server: Acces Violation ad Adress 014FD9C0 in Module .... Read of address 0000098"

I manage to get this part fixed after a lot working, but now the problem I have is when I assigned the server instance, it is assigned as null, can't figure out the reason why, since in the code above does that, been here for a while now but can't get past this part.

1

There are 1 best solutions below

0
Jp191290 On

Manage to fix this: in order to use local data adapter to connect to another service containing datatables, the service you are conecting to must be a descendant of TDataAbstractService,otherwise it will return a read of acces error.

the code making the connection is actually correct.