Autor Beitrag
Passi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Di 13.01.04 18:11 
hi,
habe schon wieder ein problem :?
und zwar möchte ich überprüfen, ob es einen datensatz gibt, der im feld 'bereich', den eintrag hat, den man in ein dbedit feld eingibt.
also etwa so:
ausblenden Delphi-Quelltext
1:
2:
3:
table2.filtered :=  False;
table2.filter := 'Bereich = '+QuotedStr(dbedit8.text);
table2.filtered :=  true;

soweit so gut :) . aber jetzt brauche ich eine if anweisung, die wenn ein datensatz gefunden wurde, abbricht und wenn keiner gefunden wird, dann weitere sachen ausführt...
also
if ...
then ...
else ...

hoffe mir kann mal wieder jemand helfen :wink:
KidPaddle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 351

WinXP,Linux
D7 Prof, XE7
BeitragVerfasst: Di 13.01.04 19:07 
Da gibt es mehrere Möglichkeiten:
ausblenden Delphi-Quelltext
1:
2:
3:
if table2.IsEmpty then begin
end else begin
end;

oder etwas unsicherer, weil, je nach DB, auch -1 zurück kommen kann,
ausblenden Delphi-Quelltext
1:
2:
3:
if (table2.RecordCount = 0) then begin
end else begin
end;

oder
ausblenden Delphi-Quelltext
1:
2:
3:
if table2.BOF and table2.EOF then begin
end else begin
end;

Kannst Dir also was aussuchen :)

Gruß
KidPaddle

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.