?
Solved

Mutliple Datasources in DBGrid

Posted on 1998-02-28
8
Medium Priority
?
325 Views
Last Modified: 2010-04-06
How can I gave multiple datasources in a single DBGrid?  I have a Master tables that has several details tables (5).  I want only certain coulmns from each detail table to appear in the grid.  How can I do this?

The solution given must allow a quick update of the DBGrid, so quering each detail table when the master record change is just too slow.

I will increase teh points if necessary.
0
Comment
Question by:d4jaj1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359905
That was also something that I wanted to accomplish, but... I think it isn't that easy. I think a new component has to be made. I don't know yet how to solve this problem.
0
 

Expert Comment

by:jpussacq
ID: 1359906
You can create a view in the Datab Base.
0
 

Expert Comment

by:bijoyn
ID: 1359907
Hi ,

Well first of all u cannot assign mulitple datasources to one DBGrid. At any point of time the grid will talk to only one datasources. U can make it talk to multiple datasources one after the other but only one at a time.

Secondly how can u show data from more than one detail table in the same grid for a master record. In each of the five detail tables that u have u must be having one to many detail records for each master records right ?. Now if u read all the detail tables  at the same time then in one row of the grid how are u going to show the multiple values coming from the detail tables ?

U need to show the one to many relationships in more than one grid ( in your case 5 separate grids ). But if u still want to do what u are doing then there is a solution for it.

Tell me if u are interested. Send me your email address and I will send u an example.

Cheers,

Bijoy
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Expert Comment

by:bijoyn
ID: 1359908
Hi ,

Well first of all u cannot assign mulitple datasources to one DBGrid. At any point of time the grid will talk to only one datasources. U can make it talk to multiple datasources one after the other but only one at a time.

Secondly how can u show data from more than one detail table in the same grid for a master record. In each of the five detail tables that u have u must be having one to many detail records for each master records right ?. Now if u read all the detail tables  at the same time then in one row of the grid how are u going to show the multiple values coming from the detail tables ?

U need to show the one to many relationships in more than one grid ( in your case 5 separate grids ). But if u still want to do what u are doing then there is a solution for it.

Tell me if u are interested. Send me your email address and I will send u an example.

Cheers,

Bijoy
0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1359909
I was thinking of something like this.

Master Record  (Text boxes)
============================
Cust Name, Address, etc.

Detail Records (1 DB Grid)
===========================
  Detail Tables - Software, Certifications, etc.

      Software  |  Certifications  | Next DB Table
1     Word          MSIE
2     Delphi        PMI
3                   Experts Exchange
etc.


In the scenario above, each table name is a column heading and values from a specfic field in the table (software name, cert. name, etc) are inserted into the rows.  Notice I excluded other fields the teh detail table, like "Software Title ID".  The numbers on the left are simply the number of records each detail table has for that master record.

Thanks for all of the comments.  If anyone wants to send me an example or better solution -I'm all ears.  Email - 5429314@mcimail.com
0
 

Expert Comment

by:bijoyn
ID: 1359910
I have sent u a mail with some explanation, hope u find it useful.

Bijoy
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359911
Is it possible to send me that explanation too? Tom.Deprez@uz.kuleuven.ac.be

Regards, Zif.
0
 
LVL 3

Accepted Solution

by:
KE earned 100 total points
ID: 1359912
Hi there,

A late answer. You can add some calculated fields in the to the detail table, which get's their data from the master table.
Dbl-click your table component, and select New field. Adjust the new field, with the field editor, so it matches the master field your'e interested in- Write an OnCalc event-handler to the detail table, which does smth. like this:

DetailTable.FieldByName('MyNewField').AsString := MasterTable.FieldByName('MasterField').AsString;

The reason why you can't have to DataSources connected to a grid, is that it wouldn't know how to navigate your DataSet when requesting new rows etc.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question