abdelkader
abdelkader

Reputation: 71

Create DBGrid columns at runtime with diffrent dataset (Table)

I want to create only certain columns on my "dbgrid" at run-time, and set them to other table field(s) or same field . How do you do that : illustration:
I have 3 Tables :

Student(IdStudent, NameStudent ...) ,

Module(idModul,NameModule...),  

Notes(idNote,idStudent,idModul,Note).

I Want to insert All Notes in one Dbgrid and names of columns of DBgrid are names of Module Table. I have No idea?

Thanks.

Upvotes: 0

Views: 923

Answers (1)

TDC
TDC

Reputation: 397

You cannot do this with a dbgrid; dbgrids have only one datasource and a datasource has only one dataset. If you are using an SQL compliant database you should look into a join and/or crosstab to return a single dataset. (I think this is what MartynA is talking about) Or create a clientdataset at run-time and build it with the columns/data you want if you want data-aware. I would look into using a stringgrid, listview or treeview and build the whole thing by hand.

Upvotes: 3

Related Questions