Writing to a Database on button click

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

Writing to a Database on button click

Postby lavitista » Mon May 14, 2018 12:55 pm

Hey Everyone

This is my first time on the forum and I have a really basic question.

Not sure if I can ask this since its so basic, but here goes:

I am trying to write data to my database, from my textfields when I click my save button.
I really have no clue how to do this.

Regards
Lavesh
lavitista
 
Posts: 1
Joined: Mon May 14, 2018 12:50 pm

Re: Writing to a Database on button click

Postby ROCLASI » Mon May 14, 2018 1:16 pm

Hi Lavesh,

First of all, welcome to the forum.
As for basic questions, of course you can ask them here. Also there are no stupid questions, only stupid (or should I say wrong) answers.

You can save ANY unsaved data using the following command:
Code: Select all
databaseManager.saveData()


When you want to save only a specific foundset you can pass the foundset like so"
Code: Select all
// when called from the form itself
databaseManager.saveData(foundset);

// when called from another form or global scope
databaseManager.saveData(forms.myForm.foundset);


You can also save one specific record, like your selected record like so:
Code: Select all
databaseManager.saveData(foundset.getSelectedRecord());


You can find more information about the databaseManager in the Wiki.


Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium


Return to Web Development

Who is online

Users browsing this forum: No registered users and 2 guests