I\'m writing a program that requires the user to select the active database at application startup. I have a Windows Form that will list the databases stored in a sub-folder
Put this line before using the ConnectionString, TableAdapter, etc... to create the thing so called DataDirectory.
I have just tested successfully by putting it right before TableAdapter.Fill(DataSet.DataTable);
AppDomain.CurrentDomain.SetData("DataDirectory", @"Full path to your data folder");
I cannot find where and what the DataDirectory is, because it doesn't exist so MSSQL will take the BaseDirectory of AppDomain.CurrentDomain instead.