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. General Programming
  3. Visual Basic
  4. app.config

app.config

Scheduled Pinned Locked Moved Visual Basic
databasecsharpasp-netsql-server
5 Posts 5 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.
  • J Offline
    J Offline
    Jay Royall
    wrote on last edited by
    #1

    I'm fairly new to VB.NET, (I was previously an ASP.NET develeper) and I have what a fairly trivial problem. I am developing a system for a client where the application gets data from a SQL Server database. I have the connection string to the database stored in the app.config file. But the problem lies in that I am using a different database when developing than that which will be used on the live system. So it means that each time I build the project to test on their machines, I have to remember to change the connection string settings before I do so (and in fact, there are other settings like file paths which need changing to). Like I said, a failry trivial isssue but if you guys have any suggestions on other ways to go about this then it would be appreciated. Thanks.

    C S M M 4 Replies Last reply
    0
    • J Jay Royall

      I'm fairly new to VB.NET, (I was previously an ASP.NET develeper) and I have what a fairly trivial problem. I am developing a system for a client where the application gets data from a SQL Server database. I have the connection string to the database stored in the app.config file. But the problem lies in that I am using a different database when developing than that which will be used on the live system. So it means that each time I build the project to test on their machines, I have to remember to change the connection string settings before I do so (and in fact, there are other settings like file paths which need changing to). Like I said, a failry trivial isssue but if you guys have any suggestions on other ways to go about this then it would be appreciated. Thanks.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I'd deploy a different app.config, or perhaps write code so that the debug version of your code reads one setting and the release, reads another. You do this with #ifdef DEBUG #else #endif in C#, I am not sure if VB is capable of that tho.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • J Jay Royall

        I'm fairly new to VB.NET, (I was previously an ASP.NET develeper) and I have what a fairly trivial problem. I am developing a system for a client where the application gets data from a SQL Server database. I have the connection string to the database stored in the app.config file. But the problem lies in that I am using a different database when developing than that which will be used on the live system. So it means that each time I build the project to test on their machines, I have to remember to change the connection string settings before I do so (and in fact, there are other settings like file paths which need changing to). Like I said, a failry trivial isssue but if you guys have any suggestions on other ways to go about this then it would be appreciated. Thanks.

        S Offline
        S Offline
        SteveNY
        wrote on last edited by
        #3

        Couple of solutions: 1. Use two different connections settings, ex: devConnectionString and ProdConnectionString 2. Make a form that allows user to input settings such as db server name etc and save those settings.

        1 Reply Last reply
        0
        • J Jay Royall

          I'm fairly new to VB.NET, (I was previously an ASP.NET develeper) and I have what a fairly trivial problem. I am developing a system for a client where the application gets data from a SQL Server database. I have the connection string to the database stored in the app.config file. But the problem lies in that I am using a different database when developing than that which will be used on the live system. So it means that each time I build the project to test on their machines, I have to remember to change the connection string settings before I do so (and in fact, there are other settings like file paths which need changing to). Like I said, a failry trivial isssue but if you guys have any suggestions on other ways to go about this then it would be appreciated. Thanks.

          M Offline
          M Offline
          Marek Grzenkowicz
          wrote on last edited by
          #4

          You can consider something like this (change DEV_COMPUTER and TEST_COMPUTER to match the names of your computers):

          <appSettings>
          <add key="ConnectionString_DEV_COMPUTER" value="..." />
          <add key="ConnectionString_TEST_COMPUTER" value="..." />
          </appSettings>

          ConfigurationManager.AppSettings("ConnectionString_" + Environment.MachineName).ToString

          1 Reply Last reply
          0
          • J Jay Royall

            I'm fairly new to VB.NET, (I was previously an ASP.NET develeper) and I have what a fairly trivial problem. I am developing a system for a client where the application gets data from a SQL Server database. I have the connection string to the database stored in the app.config file. But the problem lies in that I am using a different database when developing than that which will be used on the live system. So it means that each time I build the project to test on their machines, I have to remember to change the connection string settings before I do so (and in fact, there are other settings like file paths which need changing to). Like I said, a failry trivial isssue but if you guys have any suggestions on other ways to go about this then it would be appreciated. Thanks.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            We allow the user to select the target server from a list when they logon. This then supports Dev/UAT/Production. Some of our apps will also have multiple scenario copies the user may need to use.

            Never underestimate the power of human stupidity RAH

            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