Lazarus

Programming => Databases => Topic started by: JLWest on August 31, 2020, 05:30:02 pm

Title: (SOLVED) SQLite3 No data in grid problem.
Post by: JLWest on August 31, 2020, 05:30:02 pm
Trying to learn to use SQL3.

Have created a small program using SQL3 database, SQLConnector, SQLTransaction, SQLQuery, DataSource and DBGrid.

The Database has 3 records with 4 fields.

The program compiles and runs but no data shows in the Grid.
 
Have no idea how to fix this. need help. Thanks
 
Title: Re: SQLite3 No data in grid problem.
Post by: Soner on August 31, 2020, 06:00:28 pm
You must put your sql-query-command in SQLQuery component and connect the components among themselves.
Look at the examples  in folder lazarus\examples\database\ or put your example here.
Also tutorials (https://wiki.lazarus.freepascal.org/SQLdb_Tutorial0) are very good.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on August 31, 2020, 06:44:36 pm
Ok Here is my program attached. AS far as the tutorials go There are very few about SQl3 and Lazarus and they arn't very good.
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on August 31, 2020, 07:14:16 pm
AS far as the tutorials go There are very few about SQl3 and Lazarus and they arn't very good.
You shouldn't  explicitly be looking at sqlite3 tutorials, rather SQLDB related tutorials.

They also work for SQLite3, unless a specific underlying database feature is being used (the tutorials try to avoid that, but sometimes do mention some DB-specific related issues). The basics for working with databases and database related components is the same no matter what underlying database is being used (with the exception of a few specific ones that are customised, but those are not mentioned in the tutorials that user Soner linked to).

What is specific with regards to SQLite3 however are the SQL statements themselves. The differ between even so many (released) versions of SQL and are sometimes vendor specific. Therefor always try to verify your SQL statement related issues with the SQLite website's documentation, see https://sqlite.org/docs.html

I'm not going to state the wiki tutorials are plenty and good, but they were able to do the job for me. In case they don't for you, then you could perhaps consider adding some (specific) comments on that so that things could be improved.
Title: Re: SQLite3 No data in grid problem.
Post by: Soner on August 31, 2020, 07:21:44 pm
I corrected the errors in your example and upload it.
1) you forgot the sql command like:
SQLQuery.SQL:='select * from flight';
2) you forgot to connect SQLQuery with DataSource
3) Give full path of the database to DBConnection.DatabaseName

Maybe you will see in DBGRid same text "(MEMO)", it isn't error. SQLite is not real database, it handles all strings as memo-field. Look at this thread (https://forum.lazarus.freepascal.org/index.php/topic,19339.msg110012.html).
For ZEOS-Components you must put "Undefined_Varchar_AsString_Length=255" in DBConnection.Params, but it doesn't worked here.

Ok Here is my program attached. AS far as the tutorials go There are very few about SQl3 and Lazarus and they arn't very good.
Only DBConnection.Connectortype changes, everthing else stays same.

You should read database (https://wiki.lazarus.freepascal.org/Portal:Databases) wiki.

Edit:
You must change DBConnection.DatabaseName name in formular-designer, i set it to my folder. But in runtime-mode it set everytime right folder, see tform1.oncreate.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on August 31, 2020, 07:46:31 pm
Thank you. I Try it.

I have read and watched a few pf the tutorials. Managed to create a database, load it with data.

I'm now following Tweaking4All , Getting stated with SQLite3. However, it's dated 10/09/2013 which means it may be out of date.

I'll download you correcction and see if I Can get a little futher.

https://www.tweaking4all.com/software-development/lazarus-development/lazarus-pascal-getting-started-with-sqlite/#InstallationordistributionofSQLitewithyourLazarusapplication

Title: Re: SQLite3 No data in grid problem.
Post by: TRon on August 31, 2020, 08:05:26 pm
I'm now following Tweaking4All , Getting stated with SQLite3. However, it's dated 10/09/2013 which means it may be out of date.
It is a bit outdated and minimalistic , but should still work.

In case you are new to databases in general then you really should take your time and read a complete database tutorial. There are so many different database formats, component, etc. that you can't learn all this in say 5 minutes to an hour  :D

On a personal note, I dislike just throwing around a bunch components on a form (or datamodule) and connect the dots between them, rather do it manually. That way it is possible to see much quicker what goes wrong where exactly. e.g. a missing query you do not see unless specifically selecting the query component and looking at its properties. If I did not add it manually in code then... well... it's obvious  :)

Whatever you do, just don't try to squeeze it in on a last moments notice into your project, rather take your time and read some tutorials on how database components interact with each other. It is a rather steep learning process.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on August 31, 2020, 08:06:55 pm
@Soner

Downloaded your code. I think the zip is corrupt. It hangs my Laurasia. So I haven't been able to try it.

 
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on August 31, 2020, 08:14:32 pm
I think the zip is corrupt.
There seem to be nothing wrong with the zip-file.

Is your 'hang' caused by extracting the zip-file or rather by loading the project into Lazarus ?

fwiw: User Soner seem to be using Lazarus 2.0.11 and perhaps forgot (or is unable) to save with compatibility mode ? (e.g. the lpi files are incompatible between newer and older Lazarus versions/revisions).
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on August 31, 2020, 08:28:44 pm
@TRon

Just brand new with databases and have a meger understanding, well I guess a basic understanding of databases. Having trouble connecting SQL and Lazarus and FPC. Doing it all in code is probably the way to go in a project, however this is a small demo with one table and three records, not a project.

What really surprise  me most in all of these tutorials is the poor quality.

I think there should be a simple instruction set on how to:

Download and install SQLite3.
Downloading and installing DBmanager.
Creating a simple database with one table.
Importing a text or CVS file.
Creating a new project to connect to the database and displaying the data in a DBGrid.

A do it in as few as words as possible.

I think something like this would cut the learning curve on SQL and Lazarus by 75%.
 

Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on August 31, 2020, 08:29:35 pm
loading the project into Lazarus

My editor goes to full screen and hangs there. Have to use the task manager to get out.
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on August 31, 2020, 09:10:56 pm
loading the project into Lazarus

My editor goes to full screen and hangs there. Have to use the task manager to get out.
So it is indeed related to incompatible Lazarus project files.

Soner was so kind to mention each step that you forgot. I would suggest to do these steps manually in your original project.

The only code that he added was:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   DBConnection.DatabaseName:=ExtractFilePath(Application.ExeName)+'Flights.db';
  4.   DBConnection.Connected:=true;
  5.   SQLQuery1.Active:=true;
  6. end;
  7.  
  8. procedure TForm1.FormDestroy(Sender: TObject);
  9. begin
  10.   SQLQuery1.Active:=true;
  11.   DBConnection.Connected:=false;
  12. end;
  13.  

Just let know if you are able to follow Soner's steps or not. I could attach a working version, but you should learn how to do these steps manually because you would need to do so each time you create a project using a database. So perhaps might be able to get into the flow of things this way ?
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on August 31, 2020, 09:26:39 pm
I think something like this would cut the learning curve on SQL and Lazarus by 75%.
And that is exactly what this tutorial is doing, https://wiki.freepascal.org/SQLdb_Tutorial1, albeit it is more general but does mention what to change in case using sqlite.

It starts from step 1, which components to use, and how to connect them. There is a part 0 (https://wiki.freepascal.org/SQLdb_Tutorial0) which mention some specific with regards to the used data and there is a Howto which mentions the specifics with regards to the the different underlying database-systems (https://wiki.freepascal.org/SqlDBHowto) such as required dll's etc.

There is a reason that the tutorials are a huge read... (as the topic of databases is a rather complex one). That is why I mentioned to not try this when you only have a few minutes to an hour to spare. It really requires some careful reading and understanding. I pretty much doubt if it could be written in such a way that it could be a shorter read.

So, you might be perfectly right in (the list of) your 'complaints' but afaik it is all part of the wiki. Hence why I asked for commenting on specifics as things could perhaps be improved ?
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on August 31, 2020, 09:27:47 pm
Thanks

I deleted the demo and I'm starting over.

If I can't get it to work may ask for a working example.

Something that confuse me is installation of SQLlite3.

One demo said the SQLite.DLL should be in your project directory and C:\Windows\System

It's the only place I have seen this. Anyway I copied it to both places.
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on August 31, 2020, 09:36:02 pm
If I can't get it to work may ask for a working example.
That is perfectly ok.

Quote
Something that confuse me is installation of SQLlite3.

One demo said the SQLite.DLL should be in your project directory and C:\Windows\System

It's the only place I have seen this. Anyway I copied it to both places.
Windows.... and it s quirks  :)

Yes, both places is fine(*).

In an ideal world a user or end-user should only have to install sqlite onto his/her system and the dll's would be installed at the correct location. And that should be enough. However, using different bitness (32 vs 64) and installing different versions/revisions of SQLite makes things much more complicated then they really should.

The main concern for your development is making sure you use the correct 32/64 bit version (depending on your target for which you compile your project) and in case you are distributing your work, to make sure the end-user installs the correct version onto his/her system. As the latter proofs to be rather difficult, most developers choose to distribute the correct sqlite dll with their application, usually located in the application executable's directory (or instruct their end-user(s) to do so).

edit: (*) Some people tend to forget that placing the dll in your projects directory is not enough because Lazarus itself needs to have access to the dll in case you are working with the object inspector placing database components _and_ 'activate' them.
Title: Re: SQLite3 No data in grid problem.
Post by: Soner on August 31, 2020, 10:01:40 pm
I made mistake in example:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormDestroy(Sender: TObject);
  2. begin
  3.   SQLQuery1.Active:=false;  // this should false
  4.   DBConnection.Connected:=false;
  5. end;
  6.  

There was nothing wrong with zip, now I saved it with Lazarus 1.8.4.
When you cannot see some files then go [menu]>[project]>[project inspector] and click on some file that you want see.
When you cannot see some form then go [menu]>[window]> [center lost window] and select any window that you want to see.

When you open some project and lazarus shows error something like "property not existent", then click ingore and save form again, because some property does not more exist. I am using modified LCL, especially DBGrid.


Title: Re: SQLite3 No data in grid problem.
Post by: Soner on August 31, 2020, 10:05:17 pm
When you have Windows 64 bit then put:
 32-Bit sqlite3.dll in C:\Windows\SysWOW64 folder,
 and 64-bit sqlite3.dll in C:\Windows\C:\Windows\System32 folder.

Also you can put the rigt version(32 or 64bit) in your application and lazarus folder.
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on August 31, 2020, 10:57:40 pm
When you have Windows 64 bit then put:
 32-Bit sqlite3.dll in C:\Windows\SysWOW64 folder,
 and 64-bit sqlite3.dll in C:\Windows\C:\Windows\System32 folder.
.. and for more detailed information, see also https://www.howtogeek.com/326509/whats-the-difference-between-the-system32-and-syswow64-folders-in-windows/
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 12:38:27 am
Maybe you will see in DBGRid same text "(MEMO)", it isn't error. SQLite is not real database, it handles all strings as memo-field. Look at this thread (https://forum.lazarus.freepascal.org/index.php/topic,19339.msg110012.html).
For ZEOS-Components you must put "Undefined_Varchar_AsString_Length=255" in DBConnection.Params, but it doesn't worked here.

I have taken the liberty of attaching JLWest's project that do most things manually, instead of relying on the object inspector (actually it does rely on it for adding some basic events) and solving the (MEMO) issue (which I found somewhere here on the forums). Instructions/comments are provided in the main form unit.

However my approach of connecting OnGetText is a very naive one (most certainly wrong for most (other) situations) and should probably be solved by defining/customising the grid columns and/or datasource fields manually. I have no idea how that works exactly with SQLite.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 12:40:33 am
@Tron
Thank you

I'll take a look
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 01:17:31 am
@TRon

Compiles but when I press Button1 I get an error:

'Cannot Load SQLite library' SQLite3.DLL  it can't find SQLDLL Check your instlation;

TheSQLite3.dll is int the directory along with Flights.db.

I don't have a SQlConection to confighre so it must be a line of code ot looking for,
 
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 01:33:12 am
I don't have a SQlConection to confighre so it must be a line of code ot looking for,
I would have to look into that. My sqlite shared library is installed globally and didn't cause such an issue for me.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 01:51:40 am
I Wonder. I'm using 32bit SQlite for sure. My IDE I think May be 64Bit: How can I confirm that.

https://forum.lazarus.freepascal.org/index.php/topic,49974.0.html
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 02:16:09 am
I was trying to figure out something else first :-)

Ok, so unit sqlite3conn uses (global) variable SQLiteLibraryName to locate/name the (in case for windows) dll.

However, the use of that variable is deprecated, and we should really use (global variable) sqlite3dyn.SQLiteDefaultLibrary (meaning unit sqlite3dyn). By default (again for windows) that uses const Sqlite3Lib to declare the name. For windows that reads: "sqlite3.dll"

So, that is the first order of business.. e.g to make sure the name matches  :)

However, before tampering with that variable directly, it is stated (https://www.freepascal.org/docs-html/fcl/sqldb/universalconnectors.html) that:
Quote
From this mechanism it follows that before a particular connection type can be used, its definition must be present in the list of connector types. This means that the unit of the connection type (ibconnection, pqconnection etc.) must be included in the uses clause of the program file: if it is not included, the connection type will not be registered, and it will not be available for use in the universal connector.
afaik, that part I have covered in my comments/instructions, e.g. that you should add unit "sqlite3conn" to your uses clause.

then it reads:
Quote
The universal connector only exposes the properties common to all connection types (the ones in TSQLConnection). It does not expose properties for all the properties available in specific TSQLConnection descendents. This means that if connection-specific options must be used, they must be included in the Params property of the universal connector in the form Name=Value. When the actual connection instance is created, the connection-specific properties will be set from the specified parameters.
... and I seem unable to locate any evidence of the existence of any code that provides the name of the library using the parameters property  :(

Now, to come back to your question
Quote
I Wonder. I'm using 32bit SQlite for sure. My IDE I think May be 64Bit: How can I confirm that.
Lazarus/help/about or Lazarus/view/IDE internals/about FPC (don't forget about the second tab)

But, nothing of that matters. You can have a 16, 32, 64 , 128, or 256 bit version of Lazarus installed  :D but it will produce a 32-bit application as long as you selected that in your project options.
Lazarus/project/project options, then from the left list select Config and target, and you can see the options at the right: Target OS, Target CPU, Target processor.

That should read win32, i386 and default respectively.

Don't forget to save your changes before (re)compiling.



edit: and there is one other possibility is able to cause failure, even though you use the correct bitness of the dll, namely the dependencies for that dll. see also https://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki#q11 :
Quote
(11) Why do I get a DllNotFoundException (for "sqlite3.dll" or "SQLite.Interop.dll") when trying to run my application?

Either the named dynamic link library (DLL) cannot be located or it cannot be loaded due to missing dependencies. Make sure the named dynamic link library is located in the application directory or a directory along the system PATH and try again. Also, be sure the necessary Visual C++ runtime redistributable has been installed unless you are using a dynamic link library that was built statically linked to it.
And also with regards to the dependencies that means that those redistributable should match the bitness of your produced executable.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 02:31:33 am
"Lazarus/project/project options, then from the left list select Config and target, and you can see the options at the right: Target OS, Target CPU, Target processor."

Says Win32 Gui Application and all the rest are set as default.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 02:43:20 am
@Soner And TRon

I have I think 32Bit Target set in IDE, 32Bit DB browser that created the DB and SQLiite3.dll in C:\Windows\System32 and the project directory.

 
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 02:49:17 am
I have I think 32Bit Target set in IDE,
If you previous post is indeed correct then you have created a 32-bit application.

Quote
32Bit DB browser that created the DB
The data can be created with any application, even with an application that runs on linux/macos or otherwise. The data itself is platform agnostic.

Quote
and SQLiite3.dll in C:\Windows\System32 and the project directory.
And what bitness does your OS have ? ( https://www.howtogeek.com/howto/21726/how-do-i-know-if-im-running-32-bit-or-64-bit-windows-answers/ )

What about the dependencies ? (I added that part later to my previous post).
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 02:59:15 am
@Soner

Download and compiled your latest. Still get the error can't load Sqlite.dll. It is in the project directory and C:\windows\system32
What about trying a different Database. Is there one that's easier on Windows.


I made mistake in example:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormDestroy(Sender: TObject);
  2. begin
  3.   SQLQuery1.Active:=false;  // this should false
  4.   DBConnection.Connected:=false;
  5. end;
  6.  

There was nothing wrong with zip, now I saved it with Lazarus 1.8.4.
When you cannot see some files then go [menu]>[project]>[project inspector] and click on some file that you want see.
When you cannot see some form then go [menu]>[window]> [center lost window] and select any window that you want to see.

When you open some project and lazarus shows error something like "property not existent", then click ingore and save form again, because some property does not more exist. I am using modified LCL, especially DBGrid.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 03:53:20 am
I have a 64bit operating system, Is that the problem.

 

---------------------
System Information
------------------
      Time of this report: 1/12/2019, 21:53:47
             Machine name: DESKTOP-FRCN4JR
               Machine Id: {9926B69C-099E-4BA8-A06C-F52E5C69E7A0}
         Operating System: Windows 10 Pro 64-bit (10.0, Build 17134) (17134.rs4_release.180410-1804)
                 Language: English (Regional Setting: English)
      System Manufacturer: System manufacturer
             System Model: System Product Name
                     BIOS: BIOS Date: 07/23/17 14:04:11 Ver: 05.0000C (type: BIOS)
                Processor: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 CPUs), ~4.2GHz
                   Memory: 32768MB RAM
      Available OS Memory: 32702MB RAM
                Page File: 3735MB used, 33829MB available
              Windows Dir: C:\WINDOWS
          DirectX Version: DirectX 12
      DX Setup Parameters: Not found
         User DPI Setting: 120 DPI (125 percent)
       System DPI Setting: 144 DPI (150 percent)
          DWM DPI Scaling: Disabled
                 Miracast: Available, with HDCP
Microsoft Graphics Hybrid: Not Supported
           DxDiag Version: 10.00.17134.0001 64bit Unicode
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 04:02:02 am
I have a 64bit operating system, Is that the problem.
In that case, please update your signature to include that.

Also, as Soner already wrote:
When you have Windows 64 bit then put:
 32-Bit sqlite3.dll in C:\Windows\SysWOW64 folder,
 and 64-bit sqlite3.dll in C:\Windows\C:\Windows\System32 folder.

So, in case you are absolutely sure that you have downloaded the 32-bit version of the sqlite dll from the official SQLite.org website, then remove all previous copies (*) because you copied it into the wrong location. It should go into SysWow64 (and not System32). See also the link that I posted as a reaction to Soners post, in case you wish to know why/how.

If that still doesn't work then you have a dependency issue, in which case you should make sure to install the microsoft visual c distribution libraries for 32-bit windows. I have no idea what minimal version that should be though  :-\

(*) really make sure that windows is unable to find any sqlite dll version(s) installed at the wrong location. In case you leave remnants of that then the issue will not be solved and continue to exist.

I still find it odd though that it does not seem to favour the dll alongside your exe and instead continues to try loading from the system directory, unless it really is a dependency issue.
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 04:36:15 am
So I moved the SQlite32 to C:\Windows\SysWOW64.

No change sae error.
I think the only thing left to do is wipe the system clean. The IDE, FPC, SQL DB Browser and start over. I dont know that's its worth it.
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 05:47:50 am
I think the only thing left to do is wipe the system clean. The IDE, FPC, SQL DB Browser and start over. I dont know that's its worth it.
I fail to see the logic in that. Of course that isn't worth it.

Also it is rather pointless because no matter how many times you re-install, every time you would run into the same issues over and over again.

You simply seem to be missing a 32-bit version of msvcrt.dll, and I've already posted how you can obtain that file (*) (see also wikipedia (https://en.wikipedia.org/wiki/Microsoft_Windows_library_files#MSVCRT.DLL,_MSVCP*.DLL_and_CRTDLL.DLL) ). Simply use a dependency-walker/viewer to obtain this kind of information.

fwiw: this is a standard issue that most developers run into sooner or later and just comes with the territory. You would have more issues with using any other database, as they usually have a whole bunch of dependencies that have to be met. That said, some do come with everything included and have a nice installer. The only other possibility is using a native pascal implemented database such as dbf, cvsdataset, bufdataset, memdataset and alike.

edit
(*) here you go: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

And that for a non-windows user  :D
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 06:10:38 am
"You simply seem to be missing a 32-bit version of msvcrt.dll, and I've already posted how you can obtain that file (*) (see also wikipedia ). Simply use a dependency-walker/viewer to obtain this kind of information."

Say what? Never heard of a dependemcy walker/viewer".
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 06:24:04 am
Downloaded and installed, same error.
I don't know. going to look fir a dependency walker and  run here
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 06:35:26 am
Say what? Never heard of a dependemcy walker/viewer".
A dependency walker/viewer should be part of the toolbox of every windows developer, see also https://dependencywalker.com/

I used to use a plugin for total commander that was able to do the something similar. Speaking of which, total commander (and its plugins) is another tool that should be part of that same toolbox  ;)
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 06:41:01 am
Downloaded and installed, same error.
In that case there is another issue. If you installed the complete redistributable then that should be enough. Are you sure you downloaded https://sqlite.org/2020/sqlite-dll-win32-x86-3330000.zip ?

In case you did then one of the previous discussed topics is the culprit although I do wonder which one that would be though. afaik we've discussed everything that could cause the failure of loading the dll. The only thing I have not done is checking whether free pascal sqlite dll loader checks for a particular version (and fails if that version-check is not met).
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 06:53:17 am
Yea I'm pretty sure it is SQLite32.Dll.

I could delete it and reinstall. but sqlite-dll-win32-x86-3330000.zip and when un-ziped I had SQLite.dff and SQLite.Dll A I suppose to do something with the dff file.
Title: Re: SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 07:15:30 am
Yea I'm pretty sure it is SQLite32.Dll.
Ok, just checking  :)

Quote
I could delete it and reinstall.
Like I wrote before: reinstalling your OS and all that won't help you a bit. It rather destroys the chance to figure out what is the culprit (so that you'll never forget about that again and a chance to learn something from it).

Quote
but sqlite-dll-win32-x86-3330000.zip and when un-ziped I had SQLite.dff and SQLite.Dll A I suppose to do something with the dff file.
I could not find any evidence that the dll itself is using the definition (.def) file, but I could imagine other (3-th party) applications might perhaps depend in it. I've seen many websites mention to just copy it alongside the sqlite3.dll file. It can't hurt (it is just a simple text file).

Perhaps someone else reading this have had the same experience as you have and knows the answer or perhaps I've simply missed something that someone else knows about and is willing to share ?
Title: Re: SQLite3 No data in grid problem.
Post by: rvk on September 01, 2020, 07:49:21 am
Yea I'm pretty sure it is SQLite32.Dll.
There is no file sqlite32.dll
but sqlite-dll-win32-x86-3330000.zip and when un-ziped I had SQLite.dff and SQLite.Dll A I suppose to do something with the dff file.
There is no sqlite.dff and no sqlite.dll.

THERE IS ONLY sqlite3.def and sqlite3.dll.
And the can both be 32 bit or 64 bit.

My advise:
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 07:49:58 am
Ok here is what I did, didn't do any good:

I changed my Path.bat to include C:\Sqlite3;

Created a directory C:\SQLite3
 Rebooted
Recompiled and ran.
Same error.

I downloaded the Dependency but haven't figured out how to run it.I just installed Workflow and Dependency. Maybe I have to download the whole thing.

It's getting late here. Maybe I'm not meant to learn about databases. Least not today.

 
Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 07:55:04 am
"There is no sqlite.dff and no sqlite.dll."
Yes: sqlite3.dff and sqlite3.dll."
I'll try you latest advice and post the results:

Title: Re: SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 08:11:02 am
My advise:

    Uninstall sqlite completely.                                        (More or less done)
    Remove the dll's from system32 and from syswow64  (DONE)
    Check your bitness of lazarus under help>about (what does it say for you?)

    (See Attached screen shot, Last Line says: x86_64-Win32/64)

    If you have 32 bit Lazarus, download the 32 bit zip file for sqlite3.
    Unzip the sqlite3 zip to your exe directory and the lazarus.exe directory.

Question? Do I have 32 or 64 bit lazarus?
if 64 I assume I should copy The 64 bit  SQLite3.dll exe directory and the lazarus.exe directory.

or reinstall the 32bit lazarus
Title: Re: SQLite3 No data in grid problem.
Post by: rvk on September 01, 2020, 08:33:42 am
    (See Attached screen shot, Last Line says: x86_64-Win32/64)
Yeah, that's 64 bit (x86_64)
32 bit would say i386-win32-win32/win64

So you need to downloads the 64 bit version of sqlite3 and unzip it to your .exe directory and to lazarus.exe directory.
Title: Re: (SOLVED) SQLite3 No data in grid problem.
Post by: JLWest on September 01, 2020, 09:49:31 am
@RVK

I downloaded the 64bit version and put in my system path but not the lazuras dir abd I forgot to install it in the project directory I think.

The project compiled and ran.

A big thanks to TRon and Soner.
Title: Re: (SOLVED) SQLite3 No data in grid problem.
Post by: rvk on September 01, 2020, 09:55:19 am
The two options you have are...

Title: Re: (SOLVED) SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 10:13:53 am
The two options you have are...
Thank you for having explained that, as I wasn't sure about the IDE being one bitness and target (for which is compiled) being another.

Title: Re: (SOLVED) SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 10:15:18 am
The project compiled and ran.
Congratulations  8-)
Title: Re: (SOLVED) SQLite3 No data in grid problem.
Post by: rvk on September 01, 2020, 10:18:15 am
The two options you have are...
Thank you for having explained that, as I wasn't sure about the IDE being one bitness and target (for which is compiled) being another.
Yes, that's one possibility... compiling 32 bit on a 64 bit IDE. In that case you need 64 bit dll in lazarus.exe directory and 32 bit in your project.exe directory.

But I usually have Lazarus 2.0.10 (release version) 64 bit installed and also have 32 bit trunk.
So for me, one time I can compile a project in 32 bit and the other time in 64 bit. In that case it is handy to have them (both 32 and 64 bit dlls) in the appropriate system directory. Otherwise I keep switching those dlls in and out  :D
Title: Re: (SOLVED) SQLite3 No data in grid problem.
Post by: TRon on September 01, 2020, 10:36:39 am
So for me, one time I can compile a project in 32 bit and the other time in 64 bit. In that case it is handy to have them (both 32 and 64 bit dlls) in the appropriate system directory. Otherwise I keep switching those dlls in and out  :D
Yes, exactly the latter :D

Ah well, I've learned a lesson today as well: first check if things work for the bitness of the compiler/IDE itself before attempting anything else.

I really had the impression that user JLWest was compiling for 32-bit, but that turned out not to be the case  :-[

In his defence (as well as mine), it is rather confusing especially for newbies. Compiler/IDE is 64 bit, Widget set named "win32", target specific option "win 32 gui application", target OS "win32"/"win64", target cpu "i386" / "x86_64" and you are running on a 64 bit processor, not to mention being able to run a 32 bit OS on that as well  :-\

TinyPortal © 2005-2018