I published my project in vs2010 and im trying to deploy it to other computers. I used this connection string that runs smoothly on my pc. This code tries to retrieve the servername and try to connect to database mysysDatabase. This forcely change the app.config.
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
If cboServer.Text = "" Then
MsgBox("Please select Server First", vbInformation, "Server")
Else
Try
Dim _config As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None)
'the full name of the connection string can be found in the app.config(file)
' in the "name" attribute of the connection string
Dim conne As String = "Server=" & cboServer.Text & ";Database=mysysDatabase;Integrated Security=True"
'Also tried "Server=" & cboServer.Text & ";Database=mysysDatabase;Trusted_Connection=True"
_config.ConnectionStrings.ConnectionStrings("System.My.MySettings.SystemConnectionString").ConnectionString = conne
'Save to file
_config.Save(System.Configuration.ConfigurationSaveMode.Modified, True)
'force changes to take effect so that we can start using
'this new connection string immediately
System.Configuration.ConfigurationManager.RefreshSection(_config.ConnectionStrings.SectionInformation.Name)
Configuration.ConfigurationManager.RefreshSection("connectionString")
My.Settings.Reload()
'frmSplash.Show()
'Me.Hide()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Call frmServer_Load(sender, e)
End If
End Sub
I have a module that calls the connection string from the app.congfig then used it troughout the program.
I have a problem after installing it to other computer (client) running in windows xp sp2 and windows 7, Ive tried modifying the connection string but still the client cannot connect to the database. Am i missing something or some error with the code? I already enabled TCP/IP, firewall exection on my PC.
One more thing in publishing the project, what are the pre requisites i need to add? Im using SQL server database 2008 r2 enterprise edition
Thanks for helping