Lazarus Dbgrid Update

Posted on by
Lazarus Dbgrid Update Rating: 9,9/10 8108reviews

How to force update a DB grid? Because it should not recalculate by calling DBGrid. I tested with Delphi XE3 and UniDAC and it does update the grid with the. How to force update a DB. I tested with Delphi XE3 and UniDAC and it does update the grid with the expected values only by calling DBGrid. Idm File Mkv. DataSource.DataSet.

I may have been too clever for my own good:-/ I have a table which holds some pressure measurements. These are always stored as PSI, but the user can select a radio group button to toggle between PSI and BAR.

In order to keep the code clean and and push work onto the database, I created a second table for configuration items, with a single row. One column psi_bar_conversion will take the value either 1 or 14.5 as the user toggles the radio group. In Delphi, my query which ties to my DB grid is set up with statements like SELECT ROUND(inlet_waterPressure_psi / (SELECT psi_bar_conversion FROM configuration), (SELECT float_precision FROM configuration)) AS inlet_waterPressure, FROM measurements All of which works just fine (and perhaps I am explaining too much). All that I am tring to do is add some code in the function which handles the radio button toggle to force my DB grid to refresh its contents becuase I have just updated the value of configuration.psi_bar_conversion (but no direct field of my query, nor of my datasource). Should I invoke Refresh() or Invalidate() or SomeOtherFunction() - of the DB grid, the query, the datasrouce? That's what is confusing me. Thanks in advance for any help.

IMHO a display conversion like this have to be done client-side. What will happen when two different users are using your application connected to the same database, and one want's to see it in PSI while the other in BAR? The presentation of the data is not a thing you have to resolve at the database level, but at client level. I remember I answerd a question in this regard some days ago and, whatever it was (I don't remember the details) that's a better approach to me, because it was Client-side. – Nov 30 '12 at 3:41 •.

TDBGrid presentation depends on the connected TDataSet (via a TDataSource). To update the Grid Values you have to refresh the data in TDataSet with the method TDataSet.Refresh.

Band Of Brothers Full Torrent. I'm afarid I can't help you with the Delphi side of things here. On the datbase side of things. Is there any reason that you can't just store both the bar and psi values in the database? You could do the conversion when saving and then you are left just to do a simple select on the data when you want to view it.

This could be done by the software that is performing the save or by a trigger in the database. The reason I suggest this is that the psi-bar conversion ratio is not going to change so you are doing a bunch of processing everytime you view the data that is not required.

Lazarus Dbgrid Update