Autor Beitrag
Nightfly
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 163



BeitragVerfasst: Do 23.10.03 09:57 
Also bei empty Table bekomm ich immer "tabelle nicht exklusiv geöffnet" (bei folg. Code:)
ausblenden Delphi-Quelltext
1:
2:
3:
Table3.Close;
Table3.Open;
Table3.EmptyTAble;

Also wollte ich die TAbelle in einer Schleife löschen, und zwar so:
ausblenden Delphi-Quelltext
1:
2:
Table3.FindFirst;
repeat Table3.delete until table3.findnext = false;

Ich hab das auf nem Button, zum testen,aber ich muß 4 mal klicken ehe die TAbelle leer ist...versteh ich net :(

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
hwb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 91

Win98 SE, Win2000
D5 Prof
BeitragVerfasst: Do 23.10.03 13:17 
Ich kenns eigentlich so, daß du beim kompletten-Inhalt-löschen die Tabelle
im Exclusive-Modus geöffnet haben mußt. Das geht aber schon mal nicht, wenn du die Tabelle auch schon unter der IDE offen hast.

Einzelne Datensätze kann man auch so löschen.

Gruß Hans
Nightfly Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 163



BeitragVerfasst: Do 23.10.03 14:14 
ausblenden Quelltext
1:
2:
Table3.FindFirst; 
repeat Table3.delete until table3.eof = true;;


Das geht, weiß der Geier warum. ICh dachte beide bedingungen wären äquivalent..komische sache...
Maggi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 160

WIN XP, WIN 2003
D5 Enter D 2006
BeitragVerfasst: Do 23.10.03 14:48 
Hi Nightfly,

du kannst die Tabelle nur wirklich in eins löschen wenn du sie Exclusiv offen hast, d.h. kein anderer hat sie im Zugriff...

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
bsp.

try
  Tab.close;
  Tab.exclusive := True;
  Tab.Emptytable;
  Tab.Packtable;
  Tab.exclusive := False;
  Tab.open;
except
  Msg...
end;


Packtable solltest du auch noch machen da du die gelöschten Sätze ja eigentlich nur als gelöscht markierst und nicht wirklich aus der Datenbank nimmst, das erledigt dann Packtable für dich

Gruß

Maggi