Recent

Author Topic: Unable to see table in SQLite database  (Read 7623 times)

mrj2

  • New Member
  • *
  • Posts: 10
Unable to see table in SQLite database
« on: November 04, 2011, 07:53:48 pm »
I am trying to set up a sqlite database application.  I have put the SQLite database in the same folder as the project files.  I have the components on the form:

SQLite3Connection
   Name: SQLite3Connection1
   DatabaseName: shopper.db
   HostName:      localhost
   Transaction:   SQLTransaction1
   Connected: True

SQLQuery
   Database:   SQLite3Connection1
   Datasource:   Datasource1
   SQL:        select * from pur_his_v2
   Transaction:   SQLTransaction1

SQLTransaction
   Database:  SQLite3Connection1
   Name: SQLTransaction1
   Active: True

Datasource
   Dataset: SQLQuery1
   Enabled: True
   Name: Datasource1

When I set the SQLQuery1 Active property to true. I get a message saying “No such table: pur_his_v2”

The table is in the database.  Can anyone help.

Thanks

HappyLarry

  • Full Member
  • ***
  • Posts: 155
Re: Unable to see table in SQLite database
« Reply #1 on: November 04, 2011, 09:31:56 pm »
Hi
Leave the datasource of SQLQuery1 blank - it has no datasource.

The datasource of all the components like DBGrid, DBEdit and DBNavigator will be Datasource1.


Use Lazarus and Free Pascal and stand on the shoulders of giants . . . very generous giants. Thank you.

mrj2

  • New Member
  • *
  • Posts: 10
Re: Unable to see table in SQLite database
« Reply #2 on: November 04, 2011, 09:37:56 pm »
Hi and thank.

I have made that change but still get the same message; “No such table: pur_his_v2”.

HappyLarry

  • Full Member
  • ***
  • Posts: 155
Re: Unable to see table in SQLite database
« Reply #3 on: November 04, 2011, 09:52:55 pm »
Are you sure that
 SELECT * FROM pur_his_v2;
works properly in SQLIte3?
Do you get the proper output with no errors?
Use Lazarus and Free Pascal and stand on the shoulders of giants . . . very generous giants. Thank you.

mrj2

  • New Member
  • *
  • Posts: 10
Re: Unable to see table in SQLite database
« Reply #4 on: November 04, 2011, 09:57:02 pm »
Yes.

arbelest

  • New Member
  • *
  • Posts: 15
Re: Unable to see table in SQLite database
« Reply #5 on: November 05, 2011, 04:11:22 am »
Some time ago I got same problem.
First check and recheck that your sqlite file path is corrent. If your sqlite file path is wrong or file is not exist,
that file will be automatic created.

Say that your file store at /home/foo/project/mydata.sqlite3, but you wrong set database path as
/home/foo/project/mydate.sqlite3. So mydate.sqlite3 will be automatic create and indeed you connect to
wrong database, and all off your tables are not in there.

There will be mydate.sqlite3 and mydata.sqlite3 in /home/foo/project folder

mrj2

  • New Member
  • *
  • Posts: 10
Re: Unable to see table in SQLite database
« Reply #6 on: November 06, 2011, 11:14:08 am »
Some time ago I got same problem.
First check and recheck that your sqlite file path is corrent. If your sqlite file path is wrong or file is not exist,
that file will be automatic created.

Say that your file store at /home/foo/project/mydata.sqlite3, but you wrong set database path as
/home/foo/project/mydate.sqlite3. So mydate.sqlite3 will be automatic create and indeed you connect to
wrong database, and all off your tables are not in there.

There will be mydate.sqlite3 and mydata.sqlite3 in /home/foo/project folder

Well; what can I say except a huge thank you.  This was the problem and it now works fine.  Many many thanks!!

 

TinyPortal © 2005-2018