Hi I just installed a newer version of my program, and now one of my users is getting an occasional error. “database disk image is malformed”. I’ve googled this error and found useful information about how to restore corrupted databases.
What makes my problem unique, is that an integrity check returns ok. Also everything continues to work properly. The errors are unnerving though. I’ve noticed that half the time the error logging mechanism (see error logging details below), doesn’t write the error back to the db.
Another thing that is unsettling is that it only happens on one computer, and at only one place in the code. Here is the (seemingly normal) statement where the problem occurs. I might also mention that this method is being called from a timer once a second max (when certain flags are true). It is possible that another user is writing to the db at the time it is being read. Also the db is at a networked location on another computer. Windows 7 if that makes a difference.
dim rs as RecordSet = MainDb.SQLSelect("SELECT * FROM ProductionProgress WHERE ProductionID = '" + PID + "' ORDER BY Idx")
MainDb.ErrCheck "PListProduction 1"
I check for errors after every db read or write. Here is the error logging code:
Sub ErrCheck(Extends DB as SQLiteDatabase, msg as String = "", Log as Boolean = True)
if db.Error then
dim em As String = "Error: " + db.ErrorMessage + EndOfLine + msg
if Log Then
SQLPS = Main.MainDb.Prepare("INSERT INTO ErrorLog(Value,User,Time) VALUES(?,?,DATETIME(CURRENT_TIMESTAMP,'LOCALTIME'))")