Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Set the db dynamically in web.config

Set the db dynamically in web.config

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasesysadminhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kandalu
    wrote on last edited by
    #1

    Hi, I am using .net 2.0. I want to connect the db dynamically using web.config. I have to pass the db name only at runtime. The server name, uid, password are static in web.config. Please help me to implement this. Thanks.

    A 1 Reply Last reply
    0
    • K kandalu

      Hi, I am using .net 2.0. I want to connect the db dynamically using web.config. I have to pass the db name only at runtime. The server name, uid, password are static in web.config. Please help me to implement this. Thanks.

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Try to use System.Web.Configuration NameSpace There is a class WebConfigurationManager .This class allow you to accss web.config programmaticaly. For Every Section in web.config there is a Class in this namespce, like For AppSettingsSection there is a class AppSettingsSection, Similary for ConnectionString There is a Class ConnectionStringSection. You can retreive information by WebConfigurationManager.GetSection() . Now try to explore this area what ever i mention and try to implement. if you have anmy issue then ask me !!! Good luck :)

      cheers, Abhijit Read My Latest Article : Exploring Caching In Asp.net

      K 1 Reply Last reply
      0
      • A Abhijit Jana

        Try to use System.Web.Configuration NameSpace There is a class WebConfigurationManager .This class allow you to accss web.config programmaticaly. For Every Section in web.config there is a Class in this namespce, like For AppSettingsSection there is a class AppSettingsSection, Similary for ConnectionString There is a Class ConnectionStringSection. You can retreive information by WebConfigurationManager.GetSection() . Now try to explore this area what ever i mention and try to implement. if you have anmy issue then ask me !!! Good luck :)

        cheers, Abhijit Read My Latest Article : Exploring Caching In Asp.net

        K Offline
        K Offline
        kandalu
        wrote on last edited by
        #3

        Hi, I want to change the db according to the current month. I come to know that changing db in web.config at run time will restart the entire application. So, I used Global.asax to store the connection settings and i got it. Thanks for your reply.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups