Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using calculated fields with DBGrid ?

Status
Not open for further replies.

GlennNZ

Programmer
Jan 10, 2008
2
NZ
Hi all,

I am wondering if anyone knows hows to use calculated fields with dBGrid. I am using C++Builder v6 Enterprise version. At the moment I am using the VCL data source and query components to connect to a remote MySQL database. Then I am displaying the query results in a DBGrid.

This is all works fine and dandy and involved very little programming. The problem is that I wish to add a calculated field into the DBGrid and I can't find a way of doing it.

If this kind of functionality is not supported by DBGrid is their another component that will do the trick? Will even consider 3rd party components (freeware or commercial). Its just that this would be a great time saver for this project.

Regards
Glenn.
 
Yes, it can be done but I haven't done it. Let me look around and see what I can see unless someone else answers before I do.


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
It is done in the dataset and not the grid. Look up OnCalcFields in your help file or manual (My manual has it on pages 22-22 to 22-23 and 23-7).


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thanks,

I eventually found the answer myself as well. You have to right click on the TQuery component and select New Field then add a calculated field. I was trying to do it from the DBGrid component and was getting confused.

Cheers
Glenn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top