SQLite Forum

cannot create tables in sqlitestudio than other apps can see
Login
> I am having trouble getting a Delphi program to use sqlite. First, the program would fail with a "data exception" error, followed by a long hex number.

Is it a Delphi program you created?  If so, what was it doing? If not, would you not suspect that its identity would help others see what might be wrong?

> I made a guess that since the database file was created on a win7 computer, and now I am on a newer Win10 computer, that maybe I need to create the ...db file on the win10 computer.

An incorrect guess. SQLite database files have a platform-independent format.

> I had trouble creating the database in sqlite studio. After creating and connecting to it, it stayed frozen on the creation screen. There is an ok button but it was greyed out.The only other button was a test button, and clicking that returns a green check mark.

That is obviously self-contradictory. You had trouble "creating the database", yet after creating it, you saw some stuff. Do you mean after attempting to create it?

> I then created a table and wrote sql code to insert a record. I ran a select * on the new table and the data is there.

This suggests you were able to create *some* database. Was it the same as the one you created, attempted to create, or had trouble creating?

> I reran the delphi program and the good news is there was no external error. The bad news is it tells me there is no such table. I checked the spelling and it is correct.

This is the first useful clue. Did that spelling include the whole, absolute pathname of the database file? I would guess not, and venture that if you specify an absolute pathname you will begin to see that your "sqlite studio" session and you "delphi program" session are not referring to the same database.

> I got a clue when I went into dbbrowser for sqlite and loaded in the new database file. On the database structure tab, it shows zero tables. At least this is consistent with the Delphi program,but the obvious problem is how to get sqlite studio to commit the table addition?

I think you need fewer DB access tools, not more.  What makes you think your earlier "sqlite studio" session did not commit the table creation when you were able to select from the table?  Did you explicitly open a transaction and never close it?  I'm guessing not because that would have been a relevant fact for you to report.

> There is a "commit changes" button which I hit and it appears to work because if I exit the program and come back in, the table is there.

You seem to be reporting that "dbbrowser for sqlite" works as you expect. I do not see how that advances the investigation.

> I copied the file sqlite3.dll to the same folder of the database file, but same results.

That is immaterial. A "red herring".

I think you need to focus on exactly what file is being opened/modified by your program as a database, then use one reliable tool to see what is in fact happening to that same database. I would recommend <u>[the CLI shell](https://sqlite.org/cli.html)</u> as that tool because it will save a lot of typing and/or guessing about clicks, buttons, etc. as you proceed in your investigation and obtaining help here.