Index: VoorraadBeheerTAOR/VoorraadBeheerTAOR/My Project/Settings.Designer.vb =================================================================== diff -u -r1513 -r2104 --- VoorraadBeheerTAOR/VoorraadBeheerTAOR/My Project/Settings.Designer.vb (.../Settings.Designer.vb) (revision 1513) +++ VoorraadBeheerTAOR/VoorraadBeheerTAOR/My Project/Settings.Designer.vb (.../Settings.Designer.vb) (revision 2104) @@ -1,7 +1,7 @@ '------------------------------------------------------------------------------ ' ' This code was generated by a tool. -' Runtime Version:4.0.30319.36450 +' Runtime Version:4.0.30319.42000 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. @@ -15,7 +15,7 @@ Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase @@ -29,7 +29,7 @@ Private Shared addedHandlerLockObject As New Object _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) If My.Application.SaveMySettingsOnExit Then My.Settings.Save() End If @@ -65,6 +65,18 @@ Me("PathNaarConfig") = value End Set End Property + + _ + Public Property WinStoreConnectieString() As String + Get + Return CType(Me("WinStoreConnectieString"),String) + End Get + Set + Me("WinStoreConnectieString") = value + End Set + End Property End Class End Namespace Index: VoorraadBeheerTAOR/VoorraadBeheerTAOR/My Project/Settings.settings =================================================================== diff -u -r1513 -r2104 --- VoorraadBeheerTAOR/VoorraadBeheerTAOR/My Project/Settings.settings (.../Settings.settings) (revision 1513) +++ VoorraadBeheerTAOR/VoorraadBeheerTAOR/My Project/Settings.settings (.../Settings.settings) (revision 2104) @@ -5,5 +5,8 @@ \\NOTES01\Shared\HALUX\TA OR\Programma's\Voorraadbeheer\configs.txt + + Server=PCSPV-85299\SQLEXPRESS; database=HALUX; user=algoritmo; Pwd=algo2012 + \ No newline at end of file Index: VoorraadBeheerTAOR/VoorraadBeheerTAOR/Mappers/WinStoreMapper.vb =================================================================== diff -u -r1513 -r2104 --- VoorraadBeheerTAOR/VoorraadBeheerTAOR/Mappers/WinStoreMapper.vb (.../WinStoreMapper.vb) (revision 1513) +++ VoorraadBeheerTAOR/VoorraadBeheerTAOR/Mappers/WinStoreMapper.vb (.../WinStoreMapper.vb) (revision 2104) @@ -2,16 +2,12 @@ Imports System.Data.SqlClient Module WinStoreMapper - Private Const CONNECTIE_STRING As String = "Server=PCSPV-85299\SQLEXPRESS; database=HALUX; user=algoritmo; Pwd=algo2012" - Private sqlConnection As SqlConnection + Private ReadOnly SqlConnection As New SqlConnection With {.ConnectionString = My.Settings.WinStoreConnectieString} Private Sub ConnectToWinStore() - If sqlConnection Is Nothing Then - sqlConnection = New SqlConnection(CONNECTIE_STRING) - End If - If Not sqlConnection.State = ConnectionState.Open Then + If Not SqlConnection.State = ConnectionState.Open Then Try - sqlConnection.Open() + SqlConnection.Open() Catch ex As Exception Throw New Exception("De WinStore databank kan niet bereikt worden " & vbNewLine & ex.Message) End Try