Board index » delphi » Come'on guys...I really need help...

Come'on guys...I really need help...

Quote
Joost Leeuwesteijn wrote:

> Hallo,

> I posted this question a couple of days ago but I didn't get any response
> (until yesterday) but I still don't have the answer... And I really need the
> info for my school-project. I switched to Delphi because it's alot
> faster/smaller/ better than Paradox (5.0 Win) but I can't even display a
> simple linked-table in a DBGrid. I'll keep the question shorter this time:

> I have a table with projects (number, company number, starting date, etc)
> which is displayed in a DBGrid. I had to use SQL (TQuery) in order to display
> the company _name_ instead of the number.
> I also have a table with person-information (firstname, lastname, etc) and a
> table with 'project-team-information' (ProjectNumber and PersonNumber) to keep
> track of who works on what. The problem is when I scroll between the projects
> in DBGrid1 I want to display the _lastnames_ of the people who are
> working on it in DBGrid2. I can use a TQuery to get the person_numbers_ from
> the 'TeamTable' and display them in DBGrid2 but I have no idea how to display
> the lastnames (from the PersonTable) and refresh them every time you scroll
> between the projects in DBGrid1.

> Summary:
> {
>  ProjectTable: project#, company#, startdate, enddate, goal
>  CompanyTable: company#, companyname
>  PersonTable : person#, lastname, firstname, etc
>  TeamTable   : project#, person#

>  DBGrid1: CompanyName, Startdate, Enddate
>  DBGrid2: Person's Lastname (1 or more, from Team.DB) <- how to display the
>         _names_  & refresh them when you scroll between the projects (?????)
> }

> Thank you VERY much if you can help me! This problem happens a few times in my
> app. so I really need this information. In Paradox this was alot easier...

> Joost Leeuwesteijn, j...@il.ft.hse.nl, http://www.il.ft.hse.nl/~jace/
> Bladel, The Netherlands.

If you can get field 'person_numbers_' from the team table then
a simple join should be your answer.

select * from TeamTable, PersonTable where PersonTable.person# =
Teamtable.person#

Is this any help?

Tom Waterhouse
OMTI
t...@a.crl.com

 

Re:Come'on guys...I really need help...


The Infopower database components contain a dBGrid component that does
what I think you are trying to do. It allows you to link fields between
two tables in a DBGrid by creating a calculated field that references the
second table.

You may be able to do this with the standard DBGrid by using a calculated
field. If DBGrid2 is only suppose to display the Persons last name I'm not
clear why you are using TQuerry. Can't you display the ProjectTable in
DBGid1 and the TeamTable in DBGid2 linked via project# (both Tables need
an index on project#) then using a Calculated field in TeamTable, link
TeamTable to PersonTable via person#. If you don't want the person# to
show up in DBGrid2, set the field Visible property to false. I didn't have
time to actually try this, but I think it might work.

Re:Come'on guys...I really need help...


Quote
Tom Waterhouse <t...@a.crl.com> wrote:
>Joost Leeuwesteijn wrote:

>> Hallo,

>> I posted this question a couple of days ago but I didn't get any response
>> (until yesterday) but I still don't have the answer... And I really need the
>> info for my school-project. I switched to Delphi because it's alot
>> faster/smaller/ better than Paradox (5.0 Win) but I can't even display a
>> simple linked-table in a DBGrid. I'll keep the question shorter this time:

>> I have a table with projects (number, company number, starting date, etc)
>> which is displayed in a DBGrid. I had to use SQL (TQuery) in order to display
>> the company _name_ instead of the number.
>> I also have a table with person-information (firstname, lastname, etc) and a
>> table with 'project-team-information' (ProjectNumber and PersonNumber) to keep
>> track of who works on what. The problem is when I scroll between the projects
>> in DBGrid1 I want to display the _lastnames_ of the people who are
>> working on it in DBGrid2. I can use a TQuery to get the person_numbers_ from
>> the 'TeamTable' and display them in DBGrid2 but I have no idea how to display
>> the lastnames (from the PersonTable) and refresh them every time you scroll
>> between the projects in DBGrid1.

>> Summary:
>> {
>>  ProjectTable: project#, company#, startdate, enddate, goal
>>  CompanyTable: company#, companyname
>>  PersonTable : person#, lastname, firstname, etc
>>  TeamTable   : project#, person#

>>  DBGrid1: CompanyName, Startdate, Enddate
>>  DBGrid2: Person's Lastname (1 or more, from Team.DB) <- how to display the
>>         _names_  & refresh them when you scroll between the projects (?????)
>> }

>> Thank you VERY much if you can help me! This problem happens a few times in my
>> app. so I really need this information. In Paradox this was alot easier...

>> Joost Leeuwesteijn, j...@il.ft.hse.nl, http://www.il.ft.hse.nl/~jace/
>> Bladel, The Netherlands.
>If you can get field 'person_numbers_' from the team table then
>a simple join should be your answer.
>select * from TeamTable, PersonTable where PersonTable.person# =
>Teamtable.person#
>Is this any help?
>Tom Waterhouse
>OMTI
>t...@a.crl.com

Hi,

Try this SQL statement for your DBGrid2:
   select * from TeamTable, PersonTable where TeamTable.person# =
PersonTable.person# and TeamTable.project# = :project_number

That :project_number at the end of the query is a parameter that
should receive the number of the current project. You can either clear
and create the SQL statement with the number already in it, or you can
prepare the SQL statement and change the parameter as the project
changes (which is the faster way to do it because the database already
has a 'path' to collect the data).

Let me know if this does not clear it up for ya (and good luck on your
project),
Allen

Re:Come'on guys...I really need help...


Quote
Tom Waterhouse <t...@a.crl.com> wrote:
>Joost Leeuwesteijn wrote:

>> Hallo,

Using savvysearch or whatever other search engines you have look for
ldelphi.zip and dl it. If you can't find or get it email me and I will
file attach it and send it to you. It is a help file used at borland
tech support. Good luck!

Re:Come'on guys...I really need help...


In <4bc5ro$...@tweety.sna.com> ga...@athenon.com (Garry Freemyer)
writes:
Quote

>Tom Waterhouse <t...@a.crl.com> wrote:

>>Joost Leeuwesteijn wrote:

>>> Hallo,

>Using savvysearch or whatever other search engines you have look for
>ldelphi.zip and dl it. If you can't find or get it email me and I will
>file attach it and send it to you. It is a help file used at borland
>tech support. Good luck!

  It's available on the borland site (when it works) or at compuserv
Ben
Arrow

Other Threads