views:

259

answers:

2

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.

+1  A: 

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.

anon
I added an explicit set in the OnShow code and it seems to work, is there any known cause for these settings to get lost?
Chris J
@ChrisJ None that I could ever discover. It was also hard to reproduce consistently (but seemed to happen more often as an app grew larger) so I never got round to filing a bug report.
anon
Could it have anything to do with the order that the forms are being instantiated in by the project?
Chris J
A: 

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.

pcent
Also, you should set those properties programatically on application startup...
pcent
It wasn't active when I compiled it.
Chris J