You must Sign In to post a response.
  • Category: ASP.NET

    Changing databases at runtime in

    I have an application that requires that User A connects to Databases DB1,DB2,DB3 and so on to do simple CRUD operations...Is it possible in 3.5 to change the databases at runtime so that User A can select the database he wants from, say a DropDown list ,at runtime? ...I am using VS 2008 and C#...
  • #583510
    hi you can change web.config file at runtime for that this code is useful

    using System.Configuration;
    using System.Web.Configuration;

    Configuration Config1 = WebConfigurationManager.OpenWebConfiguration("~");
    ConnectionStringsSection conSetting = (ConnectionStringsSection)Config1.GetSection("connectionStrings");
    ConnectionStringSettings StringSettings = new ConnectionStringSettings("ConStringName", "Data Source=ServerName;Database=DataBaseName;User ID=sa;Password=12345;Integrated Security=True; Pooling=false;Connect Timeout=120;");

    hope this will help you
    and you can see my code snippets in DNS for that link is below

  • #583513

    Yes it is possible, there is a nice article in below link, just go through it for step step explanation,

    Asheej T K

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.