Solved

Mutliple Datasources in DBGrid

Posted on 1998-02-28
8
306 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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