# Refresh record from database

**URL:** <https://forum.servoy.com/t/refresh-record-from-database/6722>\
**Category:** Classic Servoy\
**Created:** [November 10, 2006, 10:14am UTC](https://forum.servoy.com/t/refresh-record-from-database/6722 "2006-11-10T10:14:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adriand](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@adriand](https://forum.servoy.com/u/adriand)\
**Post date:** [November 10, 2006, 10:14am UTC](https://forum.servoy.com/t/refresh-record-from-database/6722/1 "2006-11-10T10:14:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [November 10, 2006, 10:20am UTC](https://forum.servoy.com/t/refresh-record-from-database/6722/2 "2006-11-10T10:20:04Z")

</div>

> executing a query

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

---

<div class="post-metadata">

**Author:** ![adriand](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@adriand](https://forum.servoy.com/u/adriand)\
**Post date:** [November 10, 2006, 2:16pm UTC](https://forum.servoy.com/t/refresh-record-from-database/6722/3 "2006-11-10T14:16:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [November 10, 2006, 2:31pm UTC](https://forum.servoy.com/t/refresh-record-from-database/6722/4 "2006-11-10T14:31:35Z")

</div>

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(…)

---

<div class="post-metadata">

**Author:** ![adriand](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@adriand](https://forum.servoy.com/u/adriand)\
**Post date:** [November 10, 2006, 3:46pm UTC](https://forum.servoy.com/t/refresh-record-from-database/6722/5 "2006-11-10T15:46:46Z")

</div>

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
