Author Topic: [Solved] Can't connect to DB  (Read 478 times)


  • New Member
  • *
  • Posts: 25
[Solved] Can't connect to DB
« on: April 02, 2020, 02:46:47 am »
I'm sorry to ask such a similar question again, but I thought I had this sorted...

I've added TSQLite connection and told it where the database is and it automatically found the 'transaction' thing
I've added TSQL transaction and told it of the TSQLite connection
I've added TSQLQuery and given the TSQLite connection listed under database, but left datasource empty (as per the tutorial version I first looked at) as otherwise it complains about circular references
I've added TDataSource and told it the TSQL name.

Finally I've added a TDBGrid and told it the TDataSource

But I cannot get it to give me anything other than 0 - Title: TColumn in the list in the object inspector.

I had this working a couple of days ago; to the best of my knowledge I never modified the file afterwards but now it's not working and all attempts to try again are giving the same result.

If anyone could possibly help me work out what is going wrong, I would appreciate it. I've managed to work my way through all the other Lazarus problems I've encountered, but not this one.

« Last Edit: April 03, 2020, 08:32:09 pm by Derek2020 »


  • Sr. Member
  • ****
  • Posts: 408
Re: Can't connect to DB
« Reply #1 on: April 02, 2020, 04:00:53 am »
no error message?
what is the sql command you are using?
Have you opened the sqlquery (ee SqlQuery1.Active := true in the inspector)?
Have you connected the TsQLIte3Connection (Sqlite3Connection1.Connected := true in the inspector)?
IS the SQLite dll present in your system and accesible from lazarus?
If you are using windows you either put the dll in a know location (system, system32 ) or place a copy in the same directory as your "lazarus.exe" and your application's exe too (second copy).


  • New Member
  • *
  • Posts: 25
Re: Can't connect to DB
« Reply #2 on: April 02, 2020, 06:16:00 pm »
Hello Eljo.

Thanks for your reply. I've just realised what the problem was. I'm not sure if this is because I simply forgot something or whether it was done automatically in a previous tutorial by some other process, but it was the SQL statement in the TSQLQuery.

I'm going to have a go at doing it two or three more times from scratch and if it works each time, then I've more chance of remembering than just doing it once now and then not again.

Thanks again


TinyPortal © 2005-2018