Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3945

SQLite db closes direct after it was opened

$
0
0

I have an windows desktop application which runs good for years. I am adding/changing modules in the application, but suddenly it has a db error in a part I have not touched for years. I tried older saves too, but they got the same error. The weird thing is that the db let itself open well, and after a check if the db is op, the db closes.

f = GetFolderItem(gPathDB+"DTS.db",3)
db = new SQLiteDatabase
db.DatabaseFile=f

if db.Connect = true then
  ExecSql = "SELECT * from Disaster where dDate like '"+MyDate+"%' and dType = 'vu' and dRetPeriod > "+str(RetVUPer)
  rs = db.SQLSelect(Execsql)
  
  if rs.Field("dEvtCode").Value = Nil then
    if d.month =1 then
      ExecSql = "SELECT * from Disaster where dDate like '"+str(d.year-1)+"12' and dType = 'vu' and dRetPeriod > "+str(RetVUPer)
      rs = db.SQLSelect(Execsql)
    else
      ExecSql = "SELECT * from Disaster where dDate like '"+str(d.year)+str(format(d.month-1,"00"))+ "%' and dType = 'vu' and dRetPeriod > "+str(RetVUPer)
      rs = db.SQLSelect(Execsql)
    end if
  end if

After the “if db.Connect = true then” I see this:

and it continues till th ers statement and then I do get an “database disk image is malformed”

When I check the database with SQLite browser I can do everything. When I execute in de browser the statement as created in the code, the statement shows the record.

The weird thing is that it happened suddenly. Before today it did run like a charm.

I tried also to run the app. on a copy of the db on another disk, but same result.

I use:

Edition Windows 11 Pro
Version 23H2
Installed on ‎3-‎6-‎2024
OS build 22631.4751
Experience Windows Feature Experience Pack 1000.22700.1055.0

and HW:
|—|—|
|Processor|Intel(R) Core™ i5-6600K CPU @ 3.50GHz 3.50 GHz|
|Installed RAM|16,0 GB|
|Device ID|18FBF0B0-420C-4D12-8A36-C6F3715093DC|
|Product ID|00330-80000-00000-AA348|
|System type|64-bit operating system, x64-based processor|
|Pen and touch|No pen or touch input is available for this display|

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3945

Trending Articles