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: Mo 26.08.13 10:34 
Hi, Delpher,

im folgenden Code will ich zwischen einer alten Tabelle mit 4 WPK-Feldern und der neuen Tabelle
mit einem WPK-Feld (WPK1Name) umschalten können, also mal die eine und mal die andere laden.

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:
procedure TBuchMain.lade_Tabelle(DBTname: TTable; tabname, dbtreiber: String);
var komment : string;
begin
  if (uppercase(extractfileext(buchDM_dlg.OpenDialog1.FileName)) = '.DBF'or
     (uppercase(extractfileext(buchDM_dlg.OpenDialog1.FileName)) = '.CSV'or
     (uppercase(extractfileext(DBTname.TableName)) = '.DBF')               then
  begin
    if fileexists(tabname) then
    begin                                    //DBTname.TableType := ttdefault;   //ttdbase, ttFoxPro;
      komment := '';
      DBTname.active :=  false;
        DBTname.TableName := tabname;        komment := komment + tabname + #13; showmessage(komment);
        DBTname.DatabaseName := dbtreiber;   komment := komment + dbtreiber + #13; showmessage(komment);
        DBTname.TableType := ttFoxPro;
      DBTname.Active := true;
      CoBoxAdd(extractfilename(DBTname.TableName));   <--- hier steht der Cursor.
      if (DBTName.Name = 'TbSchueler'or (DBTName.Name = 'TbSynctab'then begin wechsel_S := true; qSchuelerSort(self); end;
      if  DBTName.Name = 'TbLK'                                        then begin wechsel_L := true; qLkSort(self); end;
      DBGrid1.Refresh;
    end
  end
end;


Die Fehlermeldung lautet:

'Indexfehler [Microsoft][ODBC Visual FoxPro Driver] Fox Error 1'. Prozess wurde angehalten ...

Bis denne
Detlef

_________________
ut vires desint, tamen est laudanda voluntas
baumina
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 305
Erhaltene Danke: 61

Win 7
Delphi 10.2 Tokyo Enterprise
BeitragVerfasst: Mo 26.08.13 11:00 
Keine Ahnung wie das bei FoxPro ist, aber wahrscheinlich genau so wie in DBase.

DBTname.IndexName (bzw. IndexFields) muss einen Index enthalten, den es auch auf der Datenbank-Tabelle geben muss.

Für diesen Beitrag haben gedankt: 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: Mo 26.08.13 20:28 
Hi,

das war's zwar nicht, aber ich habe mal ein anderes vorjahr genommen - und siehe da, es ging!!

Ich werde also mal die Datenstruktur(en) untersuchen.

Danke und bis denne,
Detlef

_________________
ut vires desint, tamen est laudanda voluntas