Autor Beitrag
D. Annies
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Sa 06.08.05 22:04 
Hi Delpher,

mit obiger repeat-Schleife habe ich Erfolg, wenn in ANZ ein Wert > 10 steht. Wie aus der Hilfe ersichtlich, kann ein einstelliger Wert so nicht erfragt werden.

Wie aber dann?

Vielen Dank für Hilfe,
D. Annies
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 07.08.05 11:24 
@all

Ich habe es "gelöst" mit

until k > trunc(ibdataset5.FieldByName('ANZ').asfloat);

Ist das ok?

Gruß, D. Annies
MarkusB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: So 07.08.05 12:11 
Moin D. Annies!

Wie ist das Feld "ANZ" in der Datenbank definiert?
Wie ist die Variable "k" definiert?

Viele Grüße
Markus
:gruebel:
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 07.08.05 13:49 
Hi,

anz in der DB ist deklariert als char(4)
anz im Code ist deklariert als integer;

D. Annies
MarkusB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: So 07.08.05 16:25 
Moin D. Annies!

Eines mal vorweg: das ist ziemlich ungesund Zahlen in alfanumerischen Felder zu speichern. Dadurch entstehen IMHO nur Probleme.

Versuchen wir das zu retten, was sich retten lässt. Ich nehme an, das Variable k ein integer ist.
Nun versuchen wir Folgendes:

ausblenden Delphi-Quelltext
1:
2:
3:
...
until k > StrToInt(ibdataset5.FieldByName('ANZ').AsString)
...


Viele Grüße
Markus
:gruebel:

Moderiert von user profile iconKlabautermann: Code- durch Delphi-Tags ersetzt.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 07.08.05 17:06 
Hi, Markus,

dann kommt leider die Fehlermeldung zur Laufzeit:

1 ist kein gültiger Integer-Wert

Ööh, Detlef Annies
MarkusB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: So 07.08.05 18:47 
Moin Detlef!

user profile iconD. Annies hat folgendes geschrieben:
Hi, Markus,

dann kommt leider die Fehlermeldung zur Laufzeit:

1 ist kein gültiger Integer-Wert

Ööh, Detlef Annies


Dann ist alles klar: der Inhalt des Feldes ANZ lässt sich nicht in ein Integer-Wert konvertieren.
Zum Beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
zahl := StrToInt('      1');  <-- ok 

zahl := StrToInt('1      ');  <-- Fehler
zahl := StrToInt('1     1');  <-- Fehler

Du musst den Inhalt des Feldes untersuchen.
Was steht eigentlich im Feld ANZ drin?

Viele Grüße
Markus
:gruebel:
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 07.08.05 18:55 
Hi Markus,

durch deine Vorgaben ist es leicht:
Mit Sicherheit steht in dem Feld 'ANZ' der Wert '1 ' es ist ja ein char(2)!
[nicht, wie oben gesagt, char(4) ]
Aha, Detlef Annies