Autor Beitrag
galbe19
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Mo 22.10.07 10:28 
Hallo

ich will ein Table leeren und ich mache es folgenderweise

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
table3.First;
while not table3.eof do
 begin
 table3.Delete;
 end;


ich benutze diese tabelle das ich aus einer anderen etwas ausfiltern will, und ich will sie nach jeder filterung leeren.
aber meine datenbank (.dbf) wird immer grosser aber sie ist immer leer.
was mache ich falsch?

mfg
Alex


Moderiert von user profile iconNarses: Topic aus VCL (Visual Component Library) verschoben am Mo 22.10.2007 um 10:39
Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 22.10.07 11:14 
Das ist ein bei Datenbanken ganz normales Verhalten. Der Speicher von gelöschten Datensätzen wird nicht (oder nicht sofort freigegeben), das musst Du selbst tun. Wie das aber mit der BDE (ist doch DBase, oder nicht?) geht, kann ich Dir nicht sagen, da ich sie seit Delphi 5 nicht mehr verwende (wird nicht mehr weiterentwickelt).
galbe19 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Mo 22.10.07 12:15 
hallo


ich habe etwas mit empty table versucht aber ich bekomme immer die fehlermeldung
table cannot be open for exclusive use

ich weiss nicht mehr weiter

mfg
alex
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mo 22.10.07 12:24 
hi

statt die Tabelle satzweise zu löschen, würde ich die ganze Tabelle per SQL löschen und neu aufbauen.

Gruß

Aga
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 22.10.07 12:27 
Moin!

Gleich vorab: ich habe von Datenbanken gerade soviel Anhung, dass ich weiß, dass ich keine Ahnung habe... :? Also bitte das Folgende mit Vorsicht genießen: ;)

Hab in einem alten Projekt auch mal sowas gemacht, hier mal der Ausschnitt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
  try
    with Matrix do begin
      Active := FALSE;
      TableType := ttParadox;
      TableName := DB_MATRIX;
      with FieldDefs do begin
        Clear;
        with AddFieldDef do begin
          Name := 'PROFIL';
          DataType := ftString;
          Size := 20;
          Required := TRUE;
        end;
        for i := 0 to FktDef.Count-1 do
          with AddFieldDef do begin
            Name := FktDef.Strings[i];
            DataType := ftString;
            Size := 1;
          end;
      end;
      CreateTable;
    end;
  except
    MessageDlg('Fehler beim Anlegen der Matrix-Tabelle!?',mtError,[mbOK],0);
  end;

Wesentliche Idee: die Tabelle deaktivieren und für gewünschte Felddefinitionen sorgen, dann einfach mit CreateTable neu anlegen. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 22.10.07 13:54 
Ohje ... kauft Ihr Euch auch gleich nen neuen Rechner, wenn Ihr das OS neu installieren wollt? :mrgreen:

Ne, an der Datenbankstruktur ändert man (außer in Ausnahmefällen) nie etwas! Daher schau mal nach, ob Du etwas zu Shrink, Compress oder Defragment in Bezug auf DBase findest, das ist eher was für Dich.