Autor Beitrag
hermannhass
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

win2000

BeitragVerfasst: Di 10.02.04 22:12 
Hallo,
wie kann ich ein numerisches Feld im Dbgrid al "0" darstellen, wenn der datenbankwert NULL ist ?
Danke
Hermann
infomio
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win xy

BeitragVerfasst: Di 10.02.04 22:55 
Query --> neues Feld hinzufügen --> berechnet angeben und irgend einen Namen vergeben. Neues Feld in DBGrid einbinden.
Query --> OnCalcFields(procedure)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure query1OnCalcFields(blblabla)
begin
  if Query1.FieldByName('A').isNull then 
     Query1.FieldByName('NeuesFeld').Value := 0
  else
     Query1.FieldByName('NeuesFeld').Value := Query1.FieldByName('A').Value

end;

_________________
Viele Wege führen nach Rom - aber welcher führt zurück???
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mi 11.02.04 12:49 
Man kann es auch umständlich machen. :wink:

Jedes Feld hat ein OnGetText-Ereignis, daß benutzt werden kann, den zu erscheinenden Anzeigetext zu ändern.

Cu,
Udontknow