Autor Beitrag
Scrat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Di 10.12.02 14:39 
Tag zusammen,

ich möchte zut Laufzeit eine Tabelle mit dazugehörgem Index erstellen:
hier ist mein Code:

ausblenden 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:
26:
27:
28:
29:
Table1.Close;
 if not Table1.exists then begin
 with Table1 do
 begin
  Active    := False;
  with FieldDefs do
  begin
   FieldDefs.Clear;
   ADD('Datum ',     ftString   ,8, True);
   ADD('Fil',        ftString  ,3, True);
   ADD('Art',        ftString  ,1, True);
   ADD('Vknr',       ftString  ,4, True);
   ADD('Erfzeit',    ftString  ,4, True);
   ADD('Einzeit',    ftString  ,4, True);
  end;
  with IndexDefs do
  begin
   IndexDefs.Clear;
   Add('DatumIndx',    'Datum',     [ixExpression]);
   Add('FilIndx',      'Fil',       [ixExpression]);
   Add('ArtIndx',      'Art',       [ixExpression]);
   Add('VknrIndx',     'Vknr',      [ixExpression]);
   Add('ErfzeitIndx',  'Erfzeit',   [ixExpression]);
   Add('EinzeitIndx',  'Einzeit',   [ixExpression]);
  end;
   createtable;
   Active := True;
  end;
 end;


Irgendwas läuft da nicht so richtig..

Fehlermeldung:
ungültiger Index Descriptor
Tabelle nicht vorhandenTabelle: c:\.....

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Di 10.12.02 14:46 
Hi
versuch mal anstelle von [ixExpression] (funktioniert nur mit DBase Tabellen) [ixCaseInsensitive] zu verwenden.
Wenn das eine Paradox-Tabelle werden soll, musst du ausserdem einen Primärindex für eine Tabelle vereinbaren.
ausblenden Quelltext
1:
IndexDefs.Add('', FeldListe, [ixPrimary]);					


Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Di 10.12.02 14:46 
Probiere es mal so :

ausblenden 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:
if not Table1.exists then begin 
with Table1 do begin 
  Active    := False; 
  with FieldDefs do begin 
   FieldDefs.Clear; 
   ADD('Datum ',     ftString   ,8, True); 
   ADD('Fil',        ftString  ,3, True); 
   ADD('Art',        ftString  ,1, True); 
   ADD('Vknr',       ftString  ,4, True); 
   ADD('Erfzeit',    ftString  ,4, True); 
   ADD('Einzeit',    ftString  ,4, True); 
  end; 
  with IndexDefs do begin 
   IndexDefs.Clear; 
   Add('DatumIndx',    'Datum',     [ixprimary, ixunique]); 
   Add('FilIndx',      'Fil',       []); 
   Add('ArtIndx',      'Art',       []); 
   Add('VknrIndx',     'Vknr',      []); 
   Add('ErfzeitIndx',  'Erfzeit',   []); 
   Add('EinzeitIndx',  'Einzeit',   []); 
  end; 
   createtable; 
   Active := True; 
  end; 
end;
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Mi 11.12.02 17:07 
Die Fehlermeldung bekomm ich nicht weg....

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Do 12.12.02 09:57 
Was bedeutet denn eigentlich die Fehlermeldung :

Ungültiger Index Descriptor

:?: :?: :?:

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Do 12.12.02 10:19 
So jetzt habe ich den Quelltext ein bischen umgeschrieben..

ausblenden volle Höhe 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:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
procedure TForm12.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then
 begin
  Self.Perform(WM_NEXTDLGCTL, 0, 0);
  Table1.Close;
  if not Table1.exists then
  begin
   with Table1 do
   begin
    Active    := False;
     DatabaseName := 'dbase';
    TableName := 'kgneu';

    with FieldDefs do
    begin
     FieldDefs.Clear;
     ADD('DATUM ',     ftString  ,8, True);
     ADD('Fil',        ftString  ,3, True);
     ADD('Art',        ftString  ,1, True);
     ADD('Vknr',       ftString  ,4, True);
     ADD('Erfzeit',    ftString  ,4, True);
     ADD('Einzeit',    ftString  ,4, True);
    end;
    with IndexDefs do
    begin
     //IndexDefs.Clear;
     Add('DATUMINDX',    'DATUM',     [ixExpression]);
     Add('FILINDX',      'FIL',       [ixExpression]);
     Add('ARTINDX',      'ART',       [ixExpression]);
     Add('VKNRINDX',     'VKNR',      [ixExpression]);
     Add('ERFZEITINDX',  'ERFZEIT',   [ixExpression]);
     Add('EINZEITINDX',  'EINZEIT',   [ixExpression]);
    end;
    createtable;
    Active := True;
   end;
  end;
 end;
 if not (key in ['0'..'9',#8]) then
 key := #0;
end;
end.



Die jetzige fehlermldung lautet:

Tabelle nicht vorhanden...

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 12.12.02 10:27 
Hi
so funktionierts:
ausblenden 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:
if not table1.exists then begin
with table1 do begin 
  Active    := False; 
  with FieldDefs do begin 
   Clear;
   ADD('Datum',     ftString   ,8, True); //Hier hattest du ein Leerzeichen hinter Datum! Das hat den Indexfehler verursacht
   ADD('Fil',        ftString  ,3, True);
   ADD('Art',        ftString  ,1, True);
   ADD('Vknr',       ftString  ,4, True);
   ADD('Erfzeit',    ftString  ,4, True);
   ADD('Einzeit',    ftString  ,4, True);
  end;
  with IndexDefs do begin
   Clear; 
   Add('DatumIndx',    'Datum',     [ixprimary, ixunique]); 
   Add('FilIndx',      'Fil',       [ixCaseInsensitive]);  
   Add('ArtIndx',      'Art',       [ixCaseInsensitive]);
   Add('VknrIndx',     'Vknr',      [ixCaseInsensitive]);
   Add('ErfzeitIndx',  'Erfzeit',   [ixCaseInsensitive]);
   Add('EinzeitIndx',  'Einzeit',   [ixCaseInsensitive]); 
  end; 
   createtable; 
   Active := True; 
  end; 
end;


Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Do 12.12.02 11:16 
Irgendwie funtzt das noch nich ......

woher weis das Programm eigentlich wo es die Tabelle erstellen soll???


Die soll es nämlich in c:\mail erstellen....

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 12.12.02 12:00 
Hi
Voraussetzungen in Table1 damit das funktioniert:
- TableName enthält Tabellename
- DatabaseName enthält entweder vorhandenen BDE-Alias oder existierenden Pfad (das ist die Antwort auf deine Frage)
- TableType enthält richtige Treibereinstellung (Sicherheitshalber)

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Do 12.12.02 12:33 
Schreibe das doch vor die Erstellung der Tabelle damit kannst Du bestimmen, wo die Datenbank hingespeichert werden soll :

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  WITH table1 DO BEGIN  
    DatabaseName:='C:\Mail;
    TableName:= 'Kunden.DB';
    Tabletype:=ttParadox;       
  END;                                  
  IF NOT FileExists(dirkunden + '\Kunden.DB') THEN BEGIN 

{... hier Deine Routine zur Erstellung Deiner Tabelle ...}

  END;
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Do 12.12.02 14:02 
Also .... jetzt kommt ja beim erstellen der Tabelle keine Fehlermeldung.

Aber die Tabelle wird auch ncht erstellt.... :lol:

So dass wenn ich auf die Tabelle zugreifen will die Fehlermeldung erscheint.

Tabelle nicht vorhanden

Es wirt keine*.dbf Tabelle und auch keine Index-Datei erstellt.

???????????????????????????????

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 12.12.02 14:26 
Hi
also ich habs nur mit Paradox-Tabellen getestet, aber das funzt einwandfrei. Prüf doch nochmal ob in dem Verzeichnis nicht aus Versehen noch Dateien mit diesem Namen vorhanden sind.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Do 12.12.02 14:59 
So....
nun sieht mein Quellcode wie folgt aus:
(ich hatte noch eine KGneu.dbf auf meinem Desktop. habe ich aber gelöscht)

ausblenden volle Höhe 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:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
procedure TForm12.FormKeyPress(Sender: TObject; var Key: Char);
begin
 if key = #13 then
 begin
  Self.Perform(WM_NEXTDLGCTL, 0, 0);
  WITH table1 DO
  BEGIN
   DatabaseName:='C:\biba\mail';
   TableName:= 'kgneu.DBF';
   Tabletype:=ttDbase;
  END;
  IF NOT FileExists('c:\biba\mail\kgneu.DBF') THEN
  BEGIN
   with table1 do
   begin
    Active    := False;
    with FieldDefs do
    begin
     Clear;
     ADD('Datum',   ftString  ,8, True);
     ADD('Fil',     ftString  ,3, True);
     ADD('Art',     ftString  ,1, True);
     ADD('Vknr',    ftString  ,4, True);
     ADD('Erfzeit', ftString  ,4, True);
     ADD('Einzeit', ftString  ,4, True);
    end;
    with IndexDefs do
    begin
     Clear;
     Add('DatumIndx',   'Datum',     [ixprimary, ixunique]);
     Add('FilIndx',     'Fil',       [ixExpression]);
     Add('ArtIndx',     'Art',       [ixExpression]);
     Add('VknrIndx',    'Vknr',      [ixExpression]);
     Add('ErfzeitIndx', 'Erfzeit',   [ixExpression]);
     Add('EinzeitIndx', 'Einzeit',   [ixExpression]);
    end;
    createtable;
    Active := True;
    close;
   end;
  end;
 end;
 if not (key in ['0'..'9',#8]) then
 key := #0;
end;


Aktuelle Fehlermeldung:-----KEINE------
Problem: Die erstellte kgneu.dbf lässt sich nicht mit einem Datenbankprogramm öffnen.
(angeblich währe es keine Tabelle)

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 12.12.02 15:29 
Ok, also wenns ne DBase Tabelle werden soll, musst du das [ixCaseInsensitive] bei den Indexdefs wieder durch [] ersetzen weil das bei Dbase nicht unterstützt wird.
Habs auch damit probiert und funktioniert. .DBF und .MDX Datei wird erstellt und lässt sich auch problemlos öffnen.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Do 12.12.02 15:56 
Also nun haben wir ein Problem :P

Ich benutze das Programm Microsoft Visual FoxPro 7.0 um Datenbanken zu öffnen.


Meldung beim öffnen:

---------------------------KEINE--TABELLE----------------------


bei andere Tabellen habe ich kein Problem.


Ich habe die Felder bei Indexdefs auf:

[ixExpression] oder auch nur [] gesetzt.

Keine Änderung

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 12.12.02 16:11 
Scrat hat folgendes geschrieben:
Also nun haben wir ein Problem :P

Hast du schon mal erlebt, das beim Programmieren was ohne Probleme geht? :wink:

Scrat hat folgendes geschrieben:

Ich benutze das Programm Microsoft Visual FoxPro 7.0 um Datenbanken zu öffnen.

Na dann haben wir doch nen Schuldigen :mrgreen: Abgesehen vom BS ist mein PC Microsoft-Freie Zone :lol:
Mal im Ernst: Jetzt bin ich mit meinem Latein eigentlich auch am Ende. Zumal sich Foxpro-Tabellen eigentlich ohne Probs mit Delphi öffnen lassen.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Do 12.12.02 18:18 
@Scrat

hast Du es mal mit der Datenbankobfläche von Delphi versucht ?

@LCS

Was benutzt Du denn für ein Office ?
Scrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 73



BeitragVerfasst: Fr 13.12.02 11:46 
Ja....habe ich auch....=gleiche Problem.

_________________
Wenn ein Programm nutzlos ist, muß es dokumentiert werden.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Fr 13.12.02 12:36 
Hi
Scrat hat folgendes geschrieben:
Ja....habe ich auch....=gleiche Problem.

Ja, konnte ich auch grad nachvollziehen. Das Öffnen der Tabelle innerhalb von Delphi klappt aber problemlos. :?!?:

@bis11
StarOffice. Ich geb aber zu, dass ich noch nen zweiten Rechner habe, auf dem sich auch die übliche Microsoftsche Ausstattung befindet. :wink:

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...