CalcBASIC+Non-registred HSQLDB : How to deal with .odb.lck?

The SQL statement failed:

.
.
.
	Dim oResult As Object : oResult = oStatement.ExecuteQuery(oSQL)
	DisconnectDatabase(db)
	MsgBox "Finished"
End Sub	

So this procedure has not been called:

Sub DisconnectDatabase(db)
	db.Close
	db.Dispose()
End Sub

And .odb.lck has been created.

image description

After I opened the initial .odb, all tables remain unchanged.
What should I do with this .odb.lck ?

Hello,

You have not implemented any error handling. See:

https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Error_Handling

and

https://help.libreoffice.org/Basic/Error-Handling_Functions

A key here is to display the error yet still close the connection. Using the information in the above links, at the beginning of the Sub add:

On Local Error GoTo CloseConn

Then change this:

    Dim oResult As Object : oResult = oStatement.ExecuteQuery(oSQL)
    DisconnectDatabase(db)
    MsgBox "Finished"
End Sub

to:

    Dim oResult As Object : oResult = oStatement.ExecuteQuery(oSQL)
    DisconnectDatabase(db)
    MsgBox "Finished"
    Exit Sub
CloseConn:
    MsgBox "Error " & Err & ": " & Error$ & " (line : " & Erl & ")"
    DisconnectDatabase(db)
End Sub

For the existing .lck file, close all LO. Then insure your Base file is good. Then delete the .lck file.

Also please note, it appears messaging for the Ask site is not working. Check your posts for any responses. The problem has been reported but no known time frame for fixing it.

Dear @Ratslinger ,

Thank you so much for your support and your concern.