Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 10-01-2016, 09:52 PM
tcsh tcsh is offline
Member
 
Join Date: Sep 2016
Posts: 37
Exclamation Question regarding Data Module

Hello, I'm enjoying the wealth of information on this forum in regards to Delphi, I'm rather new so pretty excited.

I've either missed it or the information isn't here, I've read the wiki's on the issue and it got me confused, or rather, I feel it didn't clarify enough for me.

So I'll dive right in:

I use a PageControl on my main form, 2 pages on the PageControl.
Each page contains a TDBGrid.
On the 1st page using the 1st TDBGrid I call up a table in my database.
On the 2nd page using the 2nd TDBGrid I call up another table in my database.

For the 1st TDBGrid I use the following:

1 Data Module containing:

- 1x TSimpleDataSet
- 1x TDataSource
- 1x TSQLQuery
- 1x TSQLConnection

These components are for the 1st TDBGrid on Page1.
I'd like to use another TSimpleDataSet, TDataSource, TSQLQuery and TSQLConnection for the 2nd TDBGrid and fetch data from a DIFFERENT table in the same database.

My question is:

Do I have to add those 4 new components on another Data Module, subsequenty creating and adding a 2nd Data Module, or can I just place them on the 1st Data Module and just stick with that, obviously with the different settings for the new data set, source, query and connection?

Any other tips/info about this you think I should know would also be appreciated.

Thanks!

Last edited by tcsh; 10-01-2016 at 10:19 PM.
  #2  
Old 10-02-2016, 07:23 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,059
Default

<>

No...put them all on the same Data Module.
__________________
Regards,
Abdulaziz Jasser
  #3  
Old 10-02-2016, 10:44 AM
tcsh tcsh is offline
Member
 
Join Date: Sep 2016
Posts: 37
Default

Quote:
Originally Posted by Jasser View Post
<>

No...put them all on the same Data Module.
Ok, thanks.

Out of curiosity, when would you use/need to use and why an extra data module, or more?
  #4  
Old 10-02-2016, 02:38 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,059
Default

I do not see any reason for using two data modules unless maybe if you are using different types of databases in the same application then you can use one data module for each database components.
__________________
Regards,
Abdulaziz Jasser
  #5  
Old 10-02-2016, 03:49 PM
tcsh tcsh is offline
Member
 
Join Date: Sep 2016
Posts: 37
Default

Quote:
Originally Posted by Jasser View Post
I do not see any reason for using two data modules unless maybe if you are using different types of databases in the same application then you can use one data module for each database components.
I see, thanks for the help
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 08:02 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.