Ask Your Question
0

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

asked 2019-11-22 09:29:19 +0100

lonk gravatar image

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 ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-11-22 19:06:05 +0100

Ratslinger gravatar image

Hello,

You have not implemented any error handling. See:

https://wiki.openoffice.org/wiki/Docu...

and

https://help.libreoffice.org/Basic/Er...

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
edit flag offensive delete link more

Comments

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.

Ratslinger gravatar imageRatslinger ( 2019-11-22 19:09:39 +0100 )edit

Dear @Ratslinger ,

Thank you so much for your support and your concern.

lonk gravatar imagelonk ( 2019-11-23 03:31:17 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-11-22 09:29:19 +0100

Seen: 19 times

Last updated: Nov 22