Thema: Delphi No Such Table

Einzelnen Beitrag anzeigen

Delbor

Registriert seit: 8. Okt 2006
Ort: St.Gallen/Schweiz
1.186 Beiträge
 
Delphi 11 Alexandria
 
#1

No Such Table

  Alt 28. Sep 2017, 19:51
Datenbank: SQLite • Version: 3 • Zugriff über: FireDac
Hi zusammen

Damit versuche ich, die Tabellen der DB abzrufen:
Delphi-Quellcode:
procedure TDMLSQLite.DataModuleCreate(Sender: TObject);
begin
  FSeitenlaenge := 200;
  TPicture.RegisterFileFormat('NEF','NEF Format',TWICImage);
  Self.FDMoniFlatFileClientLink1.Tracing := False;
  Self.FDMoniFlatFileClientLink1.FileName := ExtractFilePath(Application.ExeName) + 'trace.txt';;
  Self.FDMoniFlatFileClientLink1.Tracing := true;
  Self.FDSQLiteConnection.Connected := False;
  Self.FDSQLiteConnection.Params.Clear;
  Self.FDSQLiteConnection.Params.Add('DriverID=SQLite');
  Self.FDSQLiteConnection.Params.Add('Database=M:\SQLite-DB Corner\ContentMasterData\ContentmasterData.sqlite');
  Self.FDSQLiteConnection.Connected := true;
  if Self.FDSQLiteConnection.Connected then
  begin
    Self.FDSQLiteConnection.GetTableNames('ContentmasterData','','', SQLiteTestMain.Memo2.Lines);
  end;
end;
Die Antwort von Delphi:
Zitat:
---------------------------
Im Projekt SQLiteTestProject.exe ist eine Exception der Klasse ESQLiteNativeException mit der Meldung '[FireDAC][Phys][SQLite] ERROR: no such table: ContentmasterData.sqlite_master' aufgetreten.
---------------------------
Erstellt wurde die Tabelle so:
Delphi-Quellcode:
  function TDMLSQLite.ConnectContentmasterDB : Boolean;
  begin
    try
      FDSQLiteConnection.Connected := false;
      FDSQLiteConnection.Params.Clear;
      FDSQLiteConnection.Params.Add('DriverID=SQLite');
      FDSQLiteConnection.Params.Add('Database=M:\SQLite-DB Corner\ContentmasterData\ContentmasterData.sqlite');
      FDSQLiteConnection.Params.Values['FailIfMissing'] := 'False';
      FDSQLiteConnection.Connected := true;
      Result := FDSQLiteConnection.Connected;
    except
      on E: EDatabaseError do
      begin
        ShowMessage('Fehler beim Aufbau der Datenbankverbindung: ' + #13#13 + E.Message);
        Result := False;
      end;
    end;
  end;

  procedure TDMLSQLite.ContentmasterDBCreate2;
  begin
    if ConnectContentmasterDB then
    begin
      if ExecuteSQL(CreateTbl_Bld) then
      if ExecuteSQL(CreateTbl_Galery) then
      if ExecuteSQL(CreateTbl_Album) then
      if ExecuteSQL(CreateTbl_bildtext) then
      if ExecuteSQL(CreateTblCSS) then
      if ExecuteSQL(CreateTblJavascript) then
      if ExecuteSQL(CreateTblHtml) then
      if ExecuteSQL(CreateIndexTbl_Html_Tbl_CSS1) then
      if ExecuteSQL(CreateIndexTbl_Html_Tblgalerie1) then
      if ExecuteSQL(CreateTableTblMenue) then
      if ExecuteSQL(fk_tblMenue_tbl_Html1) then
      if ExecuteSQL(CreateTableTbl_Album_has_Tbl_bildtext ) then
      if ExecuteSQL(fk_tbl_Album_has_tbl_bildtext_tbl_bildtext1) then
      if ExecuteSQL(fk_tbl_Album_has_tbl_bildtext_tbl_Album1) then
      if ExecuteSQL(CreateTableTbl_Html_has_Tbl_Bildtext ) then
      if ExecuteSQL(fk_tbl_Html_has_tbl_bildtext_tbl_bildtext1) then
          if ExecuteSQL(fk_tbl_Html_has_tbl_bildtext_tbl_Html1) then
      if ExecuteSQL(CreateTableTbl_SubMenue2) then
      if ExecuteSQL(fk_tbl_SubMenue2_tbl_SubMenue11_idx) then
      if ExecuteSQL(CreateTableTbl_SubMenue1) then
      if ExecuteSQL(fk_tbl_SubMenue1_tblMenue1_idx ) then
    end;
  end;
Die Parameter der Executeaufrufe sind jeweils Funktionen, die das gewünschte SQL-Statement zurückliefern. Die vermissste Tabelle ist definitiv nicht dabei.

Gruss
Delbor
Roger
Man muss und kann nicht alles wissen - man muss nur wissen, wo es steht.
Frei nach Albert Einstein
http://roase.ch
  Mit Zitat antworten Zitat