dataset.setValue Not save data in the Database

Questions, tips and tricks and techniques for scripting in Servoy

dataset.setValue Not save data in the Database

Postby gzola » Tue May 11, 2010 12:05 pm

Hello

Once used the method setValue to change values of records in a dataset, how do you save your changes back to Database?

Using Servoy 3.5.10 and MySql 5.0

Thanks for your help

Code: Select all
query = "SELECT quozientiid, fkid_coalizione, quoz_coaliz, flag_seggio, order_quoz, num_seggio_coaliz " +
      "FROM quozienti " +
      "WHERE fkid_tornata = 35 AND fkid_coalizione = 206 " +
      "ORDER BY quoz_coaliz desc";

quozCoalizVincente = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000)

for( var j=1 ; j <= 24 ; j++ )
{
   quozCoalizVincente.setValue(j, 4, 1);   //flag_seggio = 1;
   quozCoalizVincente.setValue(j, 5, j);   //order_quoz = j
   var test = quozCoalizVincente.getValue(j,5);
}

//This not working
var success = databaseManager.saveData();
Giovanni Zola
Servizio Innovazione Informatica
Comune di Nuoro

Version: 5.2.4 - build 1006
Java version 1.6.x (Windows 2000/2003 - XP - Vista - Windows 7)
Mysql 5.0
User avatar
gzola
 
Posts: 91
Joined: Mon Nov 29, 2004 2:24 pm
Location: Nuoro, Sardegna, Italy

Re: dataset.setValue Not save data in the Database

Postby pbakker » Tue May 11, 2010 12:21 pm

A JSDataSet is not connected to a database table, only JSFoundSets are!

A JSDataSet is just a collection of data in columns and rows, with some convenient methods.

Just like a multi dimensional Array is not connected to the database:
var multiDimensionalArray = [[0a,0b, 0c],[1a, 1b, 1c],[2a,2b,2c],[3a,3b,3c]];
multiDimensionalArray[4] = [4a,4b,4c];

If you would update a value in the array, off course nothing would change in the database, because it has no knowledge of the database.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: dataset.setValue Not save data in the Database

Postby gzola » Tue May 11, 2010 12:37 pm

Many tanks!!!
Giovanni Zola
Servizio Innovazione Informatica
Comune di Nuoro

Version: 5.2.4 - build 1006
Java version 1.6.x (Windows 2000/2003 - XP - Vista - Windows 7)
Mysql 5.0
User avatar
gzola
 
Posts: 91
Joined: Mon Nov 29, 2004 2:24 pm
Location: Nuoro, Sardegna, Italy

Re: dataset.setValue Not save data in the Database

Postby dfrazier » Fri Mar 29, 2013 9:51 pm

gzola wrote:Many tanks!!!
Attachments
T55s.jpg
T55s.jpg (151.33 KiB) Viewed 3299 times
This is my signature.
User avatar
dfrazier
 
Posts: 40
Joined: Fri Jun 29, 2012 3:43 pm
Location: Earth


Return to Methods

Who is online

Users browsing this forum: No registered users and 12 guests

cron