Autor Beitrag
tortom1000
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175

Win XP, Win Server 2003 - 2012, Win 7
Delphi 7
BeitragVerfasst: Mi 03.05.06 09:58 
Hi, ich habe ein DBGrid mit mehreren Spalten, welche Integer-Werte enthalten.
Nun würde ich gerne eine Spalte haben, welche die Summe aus drei anderen Spalten-Werten enthält. Diese Summe soll jedoch nicht in der Datenbank hinterlegt werden, sondern Zeile für Zeile berechnet werden und im Grid angezeigt werden, so als ob die Summe aus der Datenbanktabelle entstammt....
Weiß jemand, wie man so etwas anstellt?
Gruß
Tortom
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 03.05.06 10:55 
In der DS ein berechnetes Feld anlegen. In dessen OnClac-Eventhandler kannst du dann die Summe bilden.

_________________
Markus Kinzler.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 03.05.06 11:06 
Oder ein vernünftiges SQL-Statement bauen, dass zusätzlich die Summe der drei Felder enthält.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 03.05.06 11:10 
Zitat:
Oder ein vernünftiges SQL-Statement bauen, dass zusätzlich die Summe der drei Felder enthält.

Je nach Datenbank, das hat er ja nicht angegeben.

_________________
Markus Kinzler.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 03.05.06 19:34 
Eine Datenbank, die kein SQL kann, ist für mich keine Datenbank. :zwinker:
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 03.05.06 19:37 
Ich sehe das genauso. Aber wenn du dich hier im Forum umschaust wird du sehr viele Fragen zur BDE ( oft in Verbindung mit TTable) finden. (Ich weiß das BDE LocalSQL kann.)

_________________
Markus Kinzler.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 03.05.06 19:49 
Ich kann aber einfach nicht anders. Ich muss Überzeugungsarbeit leisten für TQuery und SQL. Auch wenn es nur so "subtil" geht. :twisted:
Außerdem befürchte ich beim Einsatz von OnCalcFields den Einsatz von persistenten Feldern. Und meine Meinung dazu kennst du bestimmt schon. :motz: :schmoll:
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 03.05.06 19:54 
Ich bin in Hinsicht des Einsatzen von SQL absolut deiner Meinung. Und wundere mich auch, wie viele sich immer noch (ohne Not!) mit der BDE abplagen, obwohl es bessere Alternativen gibt.

_________________
Markus Kinzler.
jsfrigo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

win xp, Win7
D2010
BeitragVerfasst: Di 09.05.06 08:35 
@tortom
'SELECT Feld1 + Feld2 + feld3 as Summenfeld FROM TABELLE'
Gruss Jörg
In die Grundsatzdiskusion will ich mich hier nicht einmischen ;-)