-1

Hi, Guys!

I'm new to Programming. I need your help!

I'm using Delphi-xe8. App ->Multi-Device Application

I've 2 Apps Let's call Server And Client.

ClientandServer

ClientDBandServerDB

I need when Client click 'CONNECT' , Client Database Should Update from Server Database!

Note: I'm using in a both side SQLite.

I need the easiest way.

Q? How UPDATE Client database From Server Database Using App tethering?

Alex Kirov
  • 217
  • 4
  • 16
  • @Tom, I know Sorry. I am still not get correct answer. I think some guys don't get my question. So I make My question clear now, let's see!!! – Alex Kirov Feb 12 '17 at 11:39
  • With respect, the reason you have not got a correct answer yet (and I've spent a long time on it) is that until now you've shown us virtually nothing of your server and client, so it's rather difficult to identify exactly what your problem is. What software are your screenshots Client DB and Server DB actually showing? Presumably the software is not your client, otherwise you wouldn't be asking. – MartynA Feb 12 '17 at 12:14
  • Dear @ MartynA 9 actually I like your answer for my ?. Regarding software Client/Server DB I'm using 'SQLite Expert Personal' with the help of this I'm creating ...*.db and u can add,delete... – Alex Kirov Feb 12 '17 at 12:50
  • Ok, so which of your questions do you think is still not answered, and why, exactly? What is it that you still do not know how to do? – MartynA Feb 12 '17 at 12:57
  • Why on earth would you put a FideDAC FDConnection and a TClientDataSet in your client? Why not use a FireDAC dataset like an FDMemTable instead? – MartynA Feb 12 '17 at 12:59
  • @ MartynA: On Client Side I put FDConnection,DSProviderConnection1 and ClientDataSet1. but on Properties DSProviderConnection1->ServerClassName:....? what I need ??? – Alex Kirov Feb 12 '17 at 13:00
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/135498/discussion-between-alex-kirov-and-martyna). – Alex Kirov Feb 12 '17 at 13:04
  • Sorry, I think you (or your qs) are in a complete muddle and need to slow down. I have absolutely no idea why you would have "FDConnection,DSProviderConnection1 and ClientDataSet1" in your client it you are trying to transfer the data using app tethering. – MartynA Feb 12 '17 at 13:05
  • @ MartynA :Ok, Let's Start from begining Which Exact Components Do I need on Client Side? – Alex Kirov Feb 12 '17 at 13:17
  • I have explained in the chat session you invited me to. – MartynA Feb 12 '17 at 13:27
  • @ MartynA In a StringGrid I changed from category ex: Cod into Cod2 it's changing in a both side. but when I close and open again it's showing old name like Cod. – Alex Kirov Feb 12 '17 at 15:41
  • @ MartynA Sorry I wanted message on a Chat session but its giving me: You must have 20 reputation on Stack Overflow to talk here. See the faq. that's why I'm typing here! – Alex Kirov Feb 12 '17 at 15:43

1 Answers1

3

My answer to your earlier q here: How to Get Images From Server using App Tethering showed you how to transfer data in a TClientDataSet in the server to one in a client using app tethering.

That method of transfer relies on a TClientDataSet's ability to save its data to a stream on the server side and to load it from a stream on the client side, using its SaveToStream and LoadFromStream. In this q, although you haven't said what your 2 rQuery components are, you are obviously using FireDAC, and its FDQuery, FDMemTable, etc have SaveToStream and LoadFromStream methods which work in a similar, virtually identical manner (from the user's pov) to the TClientDataSet. So to "update" your client-side dataset from the server-side one, you can use your dataset components in a similar manner as I've shown in my answer to your other q.

To save other readers a visit to the other q, the FireDAC code is

Server:

procedure TServerApp.DataSetToStream;
var
  Stream : TMemoryStream;
begin
  Stream := TMemoryStream.Create;
  FDQuery1.SaveToStream(Stream);
  Stream.Position := 0;
  TetheringAppProfile1.Resources.FindByName('BioLife').Value := Stream;
end;

Client

procedure TCliemtApp.TetheringAppProfile1Resources0ResourceReceived(const Sender:
    TObject; const AResource: TRemoteResource);
begin
  AResource.Value.AsStream.Position := 0;
  FDMemTable1.LoadFromStream(AResource.Value.AsStream);
end;
Community
  • 1
  • 1
MartynA
  • 30,454
  • 4
  • 32
  • 73