• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 84
  • Last Modified:

Delphi / SQL Server: refreshing single column with calculated value


following scenario:
- Delphi 10.1 Berlin
- SQL Server Database with a table "myTable", two columns "colA" and "colB"
- Open the table with SELECT colA, colB, colA * colB AS multiplyResult FROM myTable
- Form with a tDbGrid, showing all the columns

Know my question: I want to modify colA or colB (in the tDnGrid) and want that the result is displayed immediately. Is there a possibility to refresh only that calculated value without calling the refresh-method of the query (after the refresh I have to locate the row again and if it is a large table it is a performance-problem)?

Thanks for your hints, Peter
1 Solution
Geert GOracle dbaCommented:
no, you have to refresh the whole dataset, if the component is a DB Component

some components have a grid mode
in grid mode, the query fetches only the first 25 rows and loads the rest in background or upon scrolling

a calculation:
if a simple calculation, change the calculated column via code
if the calculation needs other tables for the calculation,  then there is no way except refresh

a database is multi user
it tries to stay consistent, what you ask is against consistency
how do you check if other columns were not updated by another user ?
formiAuthor Commented:
I solved it by calculating in the OnGetText-Event. Thanks for your answer.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now