relocate database connectionporblmens

  • Follow


hi,
in a vb2008 program, i connect to a db in access. If i move the db to 
another directory , i cannot connect to the db anymore. In my settings i've 
an extran  rule with Name "LocationDatabase", typed as a string,  and scope 
: by User  , and value :"D:\"
in the program I use this code  as followed :
'*************************************************************
If Not IO.File.Exists(My.Settings.LocationDatabase & "\Test.mdb") Then
   MessageBox.Show("Databse Not found")
   With Me.OFDOpenFilDialog
               .FileName = "test.mdb"
            Dim Res As DialogResult
            res= Me.OFDZoekBestand.ShowDialog
                If res = Windows.Forms.DialogResult.OK Then
                        My.Settings.LocationDatabase= 
IO.Path.GetDirectoryName(.FileName)
            End If
    End With
End If
AppDomain.CurrentDomain.SetData("Datadirectory", 
My.Settings.LocationDatabase)
'*******************************************************************************
this  was no problme in Visual basic 2005 but this will not work in 2008 ?!

who can figure this out  ??

regards, Tom




0
Reply Tom 12/18/2009 10:57:04 PM


0 Replies
177 Views

(page loaded in 0.052 seconds)

8/23/2012 6:26:17 AM


Reply: