Autor Beitrag
LickstheComp
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Fr 17.04.09 12:21 
Wenn ich Daten aus einer DB in ein Listview einlese und in einer Spalte steht nichts drinnen, kommt immer die
Fehlermeldung: Variante des Typs (Null) konnte nicht in Typ (String) konvertiert werden. Diese Meldung ist mit schon
klar aber wie kann man das umgehen?
lg
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 17.04.09 12:23 
Indem du uns erstmal zeigst, wie du das bisher machst.

_________________
PROGRAMMER: A device for converting coffee into software.
LickstheComp Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Fr 17.04.09 12:29 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
While Not ADOQUERY5.Eof do begin
list := listview2.Items.add;
list.caption :=  ADOQUERY5.FieldValues['SNR'];
list.Subitems.add(ADOQUERY5.FieldValues['status']);
list.Subitems.add(ADOQUERY5.FieldValues['Text']);
list.Subitems.add(ADOQUERY5.FieldValues['Datum']);
  ADOQUERY5.Next;
end;


Wenn jetzt bei einem Datensatz im Status nichts steht, kommt diese Meldung..
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 17.04.09 12:36 
Versuch mal FieldByName('Status').asString
Das sollte, wenn nichts drinsteht, einen Leerstring zurückgeben.

_________________
PROGRAMMER: A device for converting coffee into software.
LickstheComp Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Fr 17.04.09 12:47 
danke es geht!