3

I have a table with a couple foreign keys, something like this:

CREATE TABLE project.gl(
  id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  glaccount_id INT(11) UNSIGNED NOT NULL,
  project_id INT(11) UNSIGNED NOT NULL,
  booking_id INT(11) UNSIGNED NOT NULL,
  cc_id INT(11) UNSIGNED DEFAULT NULL,
  cu_id INT(11) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (id),
  INDEX FK_gl_booking_id (booking_id),
  INDEX FK_gl_cc_id (cc_id),
  INDEX FK_gl_cu_id (cu_id),
  INDEX FK_gl_glaccount_id (glaccount_id),
  INDEX FK_gl_project_id (project_id),
  CONSTRAINT FK_gl_booking_id FOREIGN KEY (booking_id)
  REFERENCES project.booking (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT ......

I would like to display this in a DBGrid, but of course I don't want all the *_id's to show, but instead the data the id points to.
I don't want to use a query to resolve the id's, (for now) I want to use a plain TTable.

Which DBGrid variant would you recommend that can lookup foreign keys, using something like a DBLookupComboBox in the foreign key cell?

Johan
  • 71,222
  • 23
  • 174
  • 298

3 Answers3

6

Just create a lookup field. Then the TDBGrid automatically shows a combobox for that column where you can select from the available values. The key field is automatically updated then.

Stefan Glienke
  • 18,969
  • 2
  • 42
  • 92
2

See also TDBGridEh from Ehlib, it is more "light" than ExpressQuantumGrid but pretty powerful. It is a commercial product.

Schnider
  • 83
  • 5
1

I do use the ExpressQuantumGrid from DeveloperExpress for this and many other tasks. It is very powerfull and mature and can have Lookup-Columns. But it is commercial and it is a very "heavy" component.

bluish
  • 23,093
  • 23
  • 110
  • 171
Andreas
  • 1,329
  • 1
  • 9
  • 19