Error Handlicng when Table Doesn't Exists lazarus / 16-Databases ---------------------------------------------------------------------- Weitentaaal · 2020-11-17 13:51 Hey Guys, So i Got This Code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i try     MacAd := dbHist.FieldByName('ProgID').AsString;except      on E : EDatabaseError do begin           //ShowMessage('DB ERROR:' + ' ' + E.ClassName + ' ' + E.Message);          //If This Table (RollBK) Doesnt Exists, then create it -->          //SQL := 'CREATE TABLE ROLLBK (Td DATE, Tt TIME, Zeichnung INTEGER, Part INTEGER, Act INTEGER, Pid TEXT(20));';      end;   end;  Any1 any Idea how i Can do this ? Thanks A Lot ---------------------------------------------------------------------- Zvoni · 2020-11-17 14:29 Huh? https://www.freepascal.org/docs- html/fcl/sqldb/tsqlconnection.gettablenames.html Why not just look it up beforehand? ---------------------------------------------------------------------- Weitentaaal · 2020-11-18 09:31 i just searched for the Wrong Thing Sorry ---------------------------------------------------------------------- rvk · 2020-11-18 09:38 And besides that... you have the try/except around the wrong code. That will only trigger the except if there is no FIELD ProgID. If you use a table which doesn't exists (like stated in your title) you need to put the sql.open (with SELECT) inside try/except. Then you can examine the exception if it contains "table not found" or something (depending on your database). Checking beforehand with gettablenames would indeed be preferable over exceptionhandling. ---------------------------------------------------------------------- Weitentaaal · 2020-11-25 09:26 Thanks rvk Understand this whole thing better now. I went with the gettablenames