Forum > Database
SQLite queries at design-time doesn't work.
(1/1)
Ñuño_Martínez:
I was following the FastReport tutorial using SQLite3. I put the TSQLite3Connection, TSQLTransaction and TSQLQuery components, I "connect" the SQLite with the database file, then link with the transaction, then link the TSQLQuery component with the database and set the SQL query to retrieve data, and when I activate the query it shows an error message that says "no such table: employee". If I open the query by code it doesn't throw any error. What I see is that TSQLite3Connection doesn't open the database file (as it doesn't create the file if it doesn't exists as it does in run-time). Is this an issue or a bug? Or may be I'm doing something wrong?
I need to connect in design-time to configure the FastReport. I'm sure it can be done by code, but...
And I followed the SQLdb tutorial before, but did all the connection by code. Anyway, the table exists.
JanRoza:
Hard to say something definitive without seeing your code, but did you also put a TFrDBDataset (lazReport component) on your form and linked this to your query?
engkin:
In design time the database is expected to be in the Lazarus folder. Most likely you were looking in the project folder for the newly created db.
Ñuño_Martínez:
--- Quote from: JanRoza on May 12, 2016, 01:30:40 pm ---Hard to say something definitive without seeing your code, but did you also put a TFrDBDataset (lazReport component) on your form and linked this to your query?
--- End quote ---
Yes, I did, and checked twice to be sure. Always check twice.
BTW, I've found what happens:
First, I forgot to say that I'm using Xubuntu.
In run-time, it looks for the database file at the executable directory, but in design-time it looks for it at the $HOME directory. So, if I have a copy of the database at $HOME it works.
Note that if I put the full path (like "/home/guillermo/projects/program/database.sqlite") in design-time it still looks for database at $HOME.
I think it is not the desired behaviour, so it is a bug, isn't it?
Navigation
[0] Message Index