Refresh record from database

Hello,

I am executing a query that modifies the database and want to display the updated values in a form. In order to refresh the records, I have the code

databaseManager.refreshRecordFromDatabase(forms.MyForm.foundset, -1)

and it doesn’t work (strangely, some records are refreshed and some are not). The foundset is correct, if I loop through it and do a refresh for each record, it works… but it takes much longer. It also takes long to update the foundset by looping and also it takes long to use a foundsetUpdater.

I am running Servoy 2.2.5-build 337, Java version 1.5.0_06-b05 (Windows XP).

Thanks for your help,
Adrian.

executing a query

How do you execute that query? Within Servoy (rawSQL plugin) or outside of Servoy?

I use the following code:

plugins.SQLPlugin.executeStatement(“jdbc:sybase:Tds:localhost:2638?ServiceName=” + globals.serverName +“&CHARSET=utf8”, query)

so it’s within Servoy.

Best,
Adrian

OK, first of all you can simply use the Servoy servername of the db connection. Is a little easier.

Second, do you flush your connection with flushAllClientsCache(…)

Nice suggestion, didn’t know about that method…

It refreshes the entire foundset, except for the first record (this one is also updated in the backend, just that it doesn’t show in the interface unless I reload the solution).

To save trouble, I use now

for(var i = 1; i<= size; i++) databaseManager.refreshRecordFromDatabase(myFoundset, i)

and it’s comparable as speed with the previous aproaches (plugins.rawSQL.flushAllClientsCache and databaseManager.refreshRecordFromDatabase(myFoundset, -1)

Thanks for your effort,
Adrian