I have created a windiws forms program in visual studio. I am using a local mdf database file. I have also imported the same database inte my sql server. I hav altered the connectionstring in my.settings, But when I try to connect to the sql database the debugging just shuts down with noe errors. The codde I use to set the connectionstring is:
DS2 = "Data Source=" + TextBox1.Text + ";Network Library=DBMSSOCN ;Initial Catalog=" + TextBox2.Text + ";User ID=" + TextBox3.Text + ";Password=" + TextBox4.Text + ""
connetionString = DS2
In settings.vb I have entered this code:
Namespace My
'This class allows you to handle specific events on the settings class:
' The SettingChanging event is raised before a setting's value is changed.
' The PropertyChanged event is raised after a setting's value is changed.
' The SettingsLoaded event is raised after the setting values are loaded.
' The SettingsSaving event is raised before the setting values are saved.
Partial Friend NotInheritable Class MySettings
Public WriteOnly Property RuntimeConnectionString() As String
Set(ByVal value As String)
My.Settings("QAConnectionString") = value
End Set
End Property
Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded
End Sub
End Class
End Namespace
Then in my main form I use this code to set det connectionstring:
My.Settings.RuntimeConnectionString = Start.DS2
I have done this before, but then I just used 2 databases in sql server and not one file and 1 server.
Anyone who has experienced this problem before?