Solved

Mutliple Datasources in DBGrid

Posted on 1998-02-28
8
304 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
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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 63
control image tags in a string ? 12 111
Adoquery sql  left join does not work 25 80
Dev express lookupcombo 3 13
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now