Shared Sub ChangeConnectionStrings() ' Get the application configuration file. Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) ' Get the current connection strings count. Dim connStrCnt As Integer = ConfigurationManager.ConnectionStrings.Count Dim csOldSettings As ConnectionStringSettings ' Get the connection strings section. Dim csSection As ConnectionStringsSection = config.ConnectionStrings ' Create the connection string name for the replacement string (same name as the one already in app.config for existing TableAdapter) Dim my_csName As String = "My.ConnectionString" Dim cs As ConnectionStringSettings = csSection.ConnectionStrings(connStrCnt) For i as Int32 = 0 To connStrCnt - 1 cs = csSection.ConnectionStrings(i) If cs.Name = my_csNameThen csOldSettings = New ConnectionStringSettings(cs.Name, cs.ConnectionString, cs.ProviderName) csSection.ConnectionStrings.Remove(csOldSettings) Exit For End If Next i ' Create a connection string element. Dim csNewSettings As New ConnectionStringSettings(csName, _ "Data Source=serverName;Initial Catalog=DataSetName;Persist Security Info=True;User ID=IDName;Password=PW", "System.Data.SqlClient") ' Add the new element. csSection.ConnectionStrings.Add(csNewSettings) ' Save the configuration file. config.Save(ConfigurationSaveMode.Modified) End Sub 'ChangeConnectionStrings şeklinde bir kod buldum ama kayıt etmiyor ancak Dim cs As ConnectionStringSettings = csSection.ConnectionStrings(connStrCnt) kısmında Index 1 is out of range. hatası veriyor yardımcı olursanız memnun olurum