0

I developed an Client/Server application, using datasnap. I need to know how to refresh the data on the server whenever a client has updated a table. The reason being that when I run a query on the client, after I inserted records into a table, the new records do not reflect in the queries.

Im using a firebird db, with datasnap, developing in Delphi XE2

Bruce McGee
  • 15,076
  • 6
  • 55
  • 70
Japster
  • 985
  • 6
  • 19
  • 38
  • 3
    Your `refreshTable` procedure is expecting a `TSQLDataSet`, but you're passing a `string` tablename as a parameter. What does the conversion for you from a `string` to a `TSQLDataSet`? – Ken White Jul 11 '12 at 20:45
  • To be honeset I have no idea how to even convert a string to a TSQLDataSet. – Japster Jul 12 '12 at 09:46
  • 1
    That's because you can't, which is why I questioned it. :-) I think you need to clarify your question to be more specific about what "server" and "client" mean - are you talking about a normal client/server application, web services (SOAP), or something else entirely? Also, "an access violation error" without any details about the error (like the **exact** error message including any addresses) is like calling your doctor and saying "I don't feel well. What's wrong?" with no other details and expecting a diagnosis and cure. We can't help you if you don't give us the tools to use to do so. – Ken White Jul 12 '12 at 10:55
  • Why do you need the client to tell the server to refresh a table that the server just updated? (The table is on the server, and the server had to do the update - it should automatically refresh the table.) Your question is extremely unclear, I'm afraid. I have no idea what you're actually asking here. – Ken White Jul 12 '12 at 15:37
  • When I insert or update a table, it does not reflect those updates on the clients. So I assumed it is because the tables on the server are not refreshed. Therefore I wanted to write a method that would refresh that particular table that I just updated. – Japster Jul 12 '12 at 15:56
  • OK. So you don't need a method for the **server** to refresh tables - you need a way for the **client** view to refresh. That's not the same thing. :-) You should edit your question to ask about how to refresh the client's view of data; this has nothing to do with the server doing anything. The **client** needs to refresh the data. – Ken White Jul 12 '12 at 16:21

2 Answers2

0

I would say, it also depends on tools you are using to write to DB.But, generally, with Firebird, you would Activate a Transaction and once update is done you would then Commit your changes. Prior to committing, no other client can see the new Changes no matter how many times they refresh. Once committed, my understanding would be to say, you would then Refresh you data by merely calling a SELECT command, as per your criteria.

0

Put a TTimer control on the client form and specify refreshing time frequency, change interval value as your needs, for example:

procedure TForm1.Timer1Timer(Sender: TObject);
begin
table1.refresh;
end;
LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114
ekrem
  • 16