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

Error deleting the file from the database

$
0
0

Hello,
all of asudden I get the following error message:
“Error deleting the file from the database: attempt to write a readonly database”.
It came out unexpectedly because in all the previous tests it work perfectly and I did not cahnge a thing.

I have three windows all connected to the same SQLite DB but different tables and report the same error.

The saving code is the same for all of them (except for the tables and ListBox names):

Dim bql As String
Dim i as Integer
Dim sql As String

//••••••••••••••••••••• Funzione di salvataggio dati nel DB SQLite esterno •••••••••••••••••••••


bql = "INSERT INTO Contr_Fatti (nome, junior, contratto, data) VALUES ( ?, ?, ?, ?);"

DB.BeginTransaction

var ok as boolean=true

sql  = "DELETE FROM Contr_Fatti"      // Comando Sql per eliminare tutte le righe salvate nel database Sql

If Contratti_Fatti.ListContrFatt.RowCount > 0 then
  
  Try
    DB.ExecuteSQL(sql) //Esegue il comando DELETE
    
  Catch err As DatabaseException
    MessageDialog.Show("Error deleting the file from the database: " + err.Message)
    Return
  End Try
  
  Try
    
    for i = 0 to Contratti_Fatti.ListContrFatt.LastRowIndex
      
      DB.ExecuteSQL( bql, Contratti_Fatti.ListContrFatt.CellTextAt(i, 0),  Contratti_Fatti.ListContrFatt.CellTextAt(i, 1), Contratti_Fatti.ListContrFatt.CellTextAt(i, 2),_
      Contratti_Fatti.ListContrFatt.CellTextAt(i, 3))
      
    next
    
    
  Catch err As DatabaseException
    MessageDialog.Show("Error deleting the file from the database: " + err.Message)
    Return
  End Try
  
  
else
  
  DB.ExecuteSQL(sql) //Esegue il comando DELETE
  
end if

if ok then
  DB.commit //solo ora salvi tutto
else
  DB.rollback 
end if

This code, probably not perfect, works in any other app I created but now it gives the error only in this single app I’m working on.

BTW, I granted unlimited permission to everyone on the SQLite DB

Any help would be appreciated

Thank you

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 3953

Trending Articles