Errors With SQLite and VB.net when reading database -
i seem receiving random error messages when trying read queries sqlite db stored on network drive. on development machine, ever error, users reporting random errors such as:
- unable open database. file encrypted or not database
- database disk image malformed
- or doesn't return data.
my code looks such:
private sub loadstorecalls() dim tmpid string dim qrystring string dim sqlconnect new sqlite.sqliteconnection() sqlconnect.connectionstring = "data source=" & spiceworkspath & ";new=false;compress=true;read only=true;" try 'open connection database sqlconnect.open() 'get storecode tmpid = mid(storecode, 2) & "-" & storename qrystring = "select id, summary, status, c_location, c_store_device tickets status = 'open' , c_location = '" & tmpid & "'" dim exqry new sqlitecommand(qrystring, sqlconnect) exqry.commandtype = commandtype.text dim da new sqlitedataadapter(exqry) dasspice.clear() da.fill(dasspice, "calls") sqlconnect.close() catch ex exception if sqlconnect.state = connectionstate.open sqlconnect.close() msgbox(ex.message) end try end sub
the problem application relies on data being returned populate additional entries of datagridview control, , because cannot replicate error on development machine using debug, cannot find fault occurring.
if user gets 1 of these errors, keep trying run query , work. or exit application , go in , seems work while. errors random , not running same query.
i'm assuming it's due issue talking sqlite db on shared drive, can't find information regarding setting timeouts. can't work out how 'catch' error because can't replicate myself. have tried adding logging details catch event handler, returns me error message (above) in logs.
any appreciated. thanks
after many hours of troubleshooting , researching found sqlite not play remote connections. not causing errors in application, throwing errors in parent application.
my alternative write application query database ran locally on sqlite machine. fixed of issues.
for interested...
Comments
Post a Comment