Chris J
Chris J

Reputation: 2206

How to get dataset to populate data into dbgrid in Delphi 6?

I have created a DBGrid in Delphi 6 and tied it to a DataSource contained in a DataModule. The Dataset for that source in also located in the same module. In the OnShow event for the form, I activate the dataset and set a label equal to the rowcount for the dataset. This shows several hundred rows but nothing shows in the dbgrid. If I activate the dataset in the IDE, the grid populates with the expected data. Does anyone have any idea why this behaviour would change between the IDE and normal runtime? We are also using SDAC connection components.

All 3rd party component choices are not mine to change.

I can elaborate as necessary for clarification, but I mainly need troubleshooting ideas to start at.

Upvotes: 0

Views: 3353

Answers (2)

pcent
pcent

Reputation: 2039

I haven't been working with delphi for a few years, but I remember that the datasource property sometimes get lost if the dataset is kept active = true in design time.

Upvotes: 1

anon
anon

Reputation:

I have observed many times in D6 that the data controls can lose their settings at runtime, particularly the ones that associate one control with another. You might like to try setting the relevant names explicitly in your OnShow code before activating the data source.

Upvotes: 2

Related Questions