Connecting two database table in one form

Questions and answers regarding general SQL and backend databases

Connecting two database table in one form

Postby mskv1309 » Mon Apr 30, 2012 4:04 pm

I am working on a form that needs to be connected with two different database table in a form. Do I need to bound my form to one database? If so, then what about other database how will I provide connection and query other database table. Is there any other solution wherein I can query both database table.
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm

Re: Connecting two database table in one form

Postby ROCLASI » Mon Apr 30, 2012 4:46 pm

Hi,

Are these 2 tables related to each other ? If so you simply create a relationship in Servoy and bind the form to the main table. Then you can add the main table and related table columns to the form.
This should also work even if the tables are in 2 different databases (i.e. connections). Just keep in mind there are some restrictions when linking 2 tables over 2 different connections.

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

Re: Connecting two database table in one form

Postby mskv1309 » Mon Apr 30, 2012 4:50 pm

Both tables are in different database and there is no relation between both tables
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm

Re: Connecting two database table in one form

Postby ROCLASI » Mon Apr 30, 2012 5:26 pm

Hi,

What it is you want to do exactly ?
Also is this form for view only or do you want to do data-entry and/or search as well ?
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

Re: Connecting two database table in one form

Postby mskv1309 » Mon Apr 30, 2012 6:02 pm

Need to work on form where user enters information which are in two different unrelated database tables and need to search in foundset whether that info is in database or not.

When user enters Id (which is in one table) I need to search in foundset that id exist or not.
Code: Select all
_foundset=databaseManager.getFoundSet('servername','tablename')
_foundset.loadRecords('SELECT id FROM employee WHERE id=? ORDER BY id', [<somevalue>]); //id is PK.
//some code.


I am able to do so, but for other entered data need to verify too which are in different database (unrelated) table.

My form is not bound with any datasource. Do I need to bound the form? If I have to then to which database I need to bound.
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 3 guests