diff --git a/App.config b/App.config
index 3fa3cae..43c1299 100644
--- a/App.config
+++ b/App.config
@@ -3,4 +3,12 @@
+
+
+
+
+
+
diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb
index 7eac279..3ea5dea 100644
--- a/MainWindow/MainWindowM.vb
+++ b/MainWindow/MainWindowM.vb
@@ -184,6 +184,7 @@ Public Class MainWindowM
GetMainPrivateProfileString(S_GENERAL, K_PHOTODIR, sDataRoot & "\Data", m_sPhotoDir)
' Creo connessione al Db
If Not ManageDb.ConnectToDb(m_sPhotoDir & "\" & DB_FILENAME) Then
+ EgtOutLog("Error connecting to DB")
MessageBox.Show(EgtMsg(MSG_OMAGPHOTO + 1), EgtMsg(MSG_EGTMSGBOX + 15), MessageBoxButton.OK, MessageBoxImage.Error)
End
End If
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 625d940..a7b48e7 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -59,5 +59,5 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/Utility/ManageDb.vb b/Utility/ManageDb.vb
index e5a5c7a..a7ae6b5 100644
--- a/Utility/ManageDb.vb
+++ b/Utility/ManageDb.vb
@@ -1,5 +1,6 @@
Imports System.IO
Imports System.Data.SQLite
+Imports EgtUILib
Module ManageDb
@@ -30,10 +31,21 @@ Module ManageDb
End Function
Friend Function ConnectToDb(DbPath As String) As Boolean
- If Not File.Exists(DbPath) Then
+ EgtOutLog("Connecting to DB " & DbPath)
+ If Not File.Exists(DbPath) Then Return False
+ Try
+ m_DbConnection = New SQLiteConnection("Data Source = " & DbPath & "; Version = 3;")
+ ' Verifica integrità del DB
+ m_DbConnection.Open()
+ Dim Command As SQLiteCommand = New SQLiteCommand("PRAGMA quick_check;", m_DbConnection)
+ Dim Reader As SQLiteDataReader = Command.ExecuteReader()
+ Reader.Read()
+ Dim sRes As String = Reader(0)
+ m_DbConnection.Close()
+ Catch ex As Exception
+ EgtOutLog(ex.Message)
Return False
- End If
- m_DbConnection = New SQLiteConnection("Data Source = " & DbPath & "; Version = 3;")
+ End Try
Return Not IsNothing(m_DbConnection)
End Function
@@ -64,13 +76,16 @@ Module ManageDb
End Function
Friend Function ExecuteSlabReaderQuery(SqlQuery As String) As List(Of Slab)
- ManageDb.DbConnection.Open()
- Dim Command As SQLiteCommand = New SQLiteCommand(SqlQuery, m_DbConnection)
- Dim Reader As SQLiteDataReader = Command.ExecuteReader()
Dim SlabList As New List(Of Slab)
- While Reader.Read()
- SlabList.Add(New Slab(Reader))
- End While
+ ManageDb.DbConnection.Open()
+ Try
+ Dim Command As SQLiteCommand = New SQLiteCommand(SqlQuery, m_DbConnection)
+ Dim Reader As SQLiteDataReader = Command.ExecuteReader()
+ While Reader.Read()
+ SlabList.Add(New Slab(Reader))
+ End While
+ Catch ex As Exception
+ End Try
ManageDb.DbConnection.Close()
Return SlabList
End Function