No Such Table lazarus / 16-Databases ---------------------------------------------------------------------- Robz · 2016-09-14 00:41 HI, This has been asked before, but none seemed to be relevant to my problem.  The error "No Such Table" is generated when I activate an sqlQuery table during design time. What is different; the design time activation worked before. I have no clue what changed. May be its quantum physics where two states exist at the same time ;-).  I can even list the tables before activating the sqlQuery table. SQLite3Connection1.GetTableNames(listBox1.Items);   if not sqlquery1.Active then     sqlquery1.Open; The above code does work. The table is listed before activation. Runtime works fine; no problems. I want to activate the sqlQuery table during design time, so that I can use the edit fields generator and create a calculated field.  May be there is a way around the hard coded method with an SQL method; but SQLite3 is new to me. So far, an SQL calculated field has proven elusive. Using Windows 10 64 bit Lazarus FPC Sqlite3 TSQLquery Any ideas Thank you Rob ---------------------------------------------------------------------- balazsszekely · 2016-09-14 04:29 Most likely the database path is wrong at design time, so SQLite silently creates a new database file, which does not contain the table. ---------------------------------------------------------------------- wp · 2016-09-14 05:35 When you work with databases at designtime you must make sure that the database path is specified as an absolute path. If if were relative it would be evaluated to be relative to Lazarus.exe at designtime. Because, however, you consider the database path to be relative to the project exe - which works at runtime - Lazarus does not find the database at designtime. ---------------------------------------------------------------------- Robz · 2016-09-14 07:27 Quote from: wp on September 14, 2016, 07:35:33 amWhen you work with databases at designtime you must make sure that the database path is specified as an absolute path. Thank you GetMen and WP for your reply. The path is absolute. In this case it's C:\Users\RobR\Documents\Bakery Since this is an SQLite3 data base application, the SQLTransaction1 contains the path. The "hostName" is set to C:\Users\RobR\Documents\Bakery and "DatabaseName" is set to "bakery.db". I think however; there is a bug. The path and db name was not changed; yet the design time activation now works. I have no clue to explain what changed. First it works, then it doesn't work and now it works again. Again, thank you for your insight. Rob ---------------------------------------------------------------------- Robz · 2016-09-16 01:30 Quote from: Robz on September 14, 2016, 02:41:34 amHI, This has been asked before, but none seemed to be relevant to my problem.  The error "No Such Table" is generated when I activate an sqlQuery table during design time. I found a cause of this problem. While it may not be the cause of the original problem, it generated the same error. I use both Tdbf dbase IV database files and TSQLquery for sqlite3 tables within the same project, even on the same form. I had to add a column to the Tdbf table and this generated an index out of range error. When I tried to enable the SQLquery table during design time, the error "no such table" message was generated. There is no link between the SQLquery table and Tdbf table yet an error in one prevented the other from activating during design time. ---------------------------------------------------------------------- LacaK · 2016-09-16 08:30 Quote from: Robz on September 14, 2016, 09:27:48 amSince this is an SQLite3 data base application, the SQLTransaction1 contains the path. The "hostName" is set to C:\Users\RobR\Documents\Bakery and "DatabaseName" is set to "bakery.db". SQLite does not use property "HostName"! You must specify both path+database file name in "DatabaseName" := 'C:\Users\RobR\Documents\Bakery\bakery.db'; ---------------------------------------------------------------------- Robz · 2016-09-16 20:22 Quote from: LacaK on September 16, 2016, 10:30:41 amSQLite does not use property "HostName"! You must specify both path+database file name in "DatabaseName" := 'C:\Users\RobR\Documents\Bakery\bakery.db'; Thank Lacak for the clarification. In my case, SQLite3Connection seems to work with only "bakery.db" as the "DatabaseName; since the db file is located in the project directory. The "HostName" was left blank. Just to verify, I should locate the db file to a directory that in not in the Lazarus path. The problem though, strongly suggests, "No such Table" design time error is caused by another component error. In this case the "index out of range" error for a TDBF component. Even after fixing the "index out of range" error, the problem persisted. A program restart did not did not fix the problem; only a Windows restart was successful. My purpose is to document what caused my error. Others may have different causes for the same type of error. Again thank you for your help Rob ---------------------------------------------------------------------- LacaK · 2016-09-17 14:22 I do nto think, that "No such Table" error is related to another error ... Simply if you in DatabaseName do not specify full path and your bakery.db is placed only in project directory then Lazarus can not find file, so by default creates new one ... check Lazarus directory and you will see there new empty barkery.db Of course this new file does not contains tables, so "No such table" error is appropriate. ---------------------------------------------------------------------- Robz · 2016-09-17 17:17 Quote from: LacaK on September 17, 2016, 04:22:08 pmI do nto think, that "No such Table" error is related to another error ... Simply if you in DatabaseName do not specify full path and your bakery.db is placed only in project directory then Lazarus can not find file, so by default creates new one ... check Lazarus directory and you will see there new empty barkery.db Of course this new file does not contains tables, so "No such table" error is appropriate. I did try and set the DataBaseName with the absolute path; it worked. I also set the DataBaseName to "bakery.db" without the full path. It also worked. You are correct, there was a blank "bakery.db" file in the Lazarus directory. Even so, either way the design time worked. The sqlite3 data was all there. It contains over 4000 records and a view of several relational tables. I did not get the "No Such Table" until after a component error. I deleted, from the Lazarus directory, the blank "bakery.db" after setting the DataBaseName to the full absolute path. This caused a problem. All visual components disappeared.  I believe that this can be restored without difficulty. I was able to activate the SQLquery table during design time; although no dbGrid was visible. Thank you LacaK for your clarification.