-1

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.

Puck
  • 2,080
  • 4
  • 19
  • 30
Jp191290
  • 51
  • 8
  • *i cant open the datatables* is not a meaningful problem description, any more than your doctor would be happy with *i dont feel good* as a description of your symptoms. – Ken White Jan 08 '16 at 20:09
  • sorry, this is the error im getting "An exception was Raised on the server: Acces Violation ad Adress 014FD9C0 in Module .... Read of addreess 0000098, this error hapens when i use the tbl_SA_Receipts.Open instruction – Jp191290 Jan 08 '16 at 20:14
  • You need to [edit] your question and put that information there, where it can be seen, instead of burying it in the comments. – Ken White Jan 08 '16 at 23:07

1 Answers1

0

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.

Jp191290
  • 51
  • 8