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. Integrate AppConfig file

Integrate AppConfig file

Scheduled Pinned Locked Moved Visual Basic
databasexmlhelptutorialworkspace
4 Posts 4 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
    Joey Picerno
    wrote on last edited by
    #1

    Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME

    R L H 3 Replies Last reply
    0
    • J Joey Picerno

      Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME

      R Offline
      R Offline
      rudy net
      wrote on last edited by
      #2

      Right click on your project, select "Add -> New Item" and select "Application Configuration File". Make sure it is called "App.Config". On your application drag from the toolbar to your form a "SqlConnection" object. View properties of SqlConnection object and select "Dynamic Properties" then Check the default "Connection String". Next, create a connection string and save all. By now you should see in "App.Config" a key value pair that is added for your SqlConnection object and its connection string. To read from your code: using System.Configuration myConnectionString = ConfigurationSettings.AppSettings("your key name")

      1 Reply Last reply
      0
      • J Joey Picerno

        Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME

        L Offline
        L Offline
        Len Miller
        wrote on last edited by
        #3

        I you want to do this in code (versus the IDE) let me know, or, if you need XML that you can read AND write from code (like by screens from user input) let me know. I have some real-work examples. If the IDE workds for you - great. Good luck - Len Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln

        1 Reply Last reply
        0
        • J Joey Picerno

          Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME

          H Offline
          H Offline
          Het2109
          wrote on last edited by
          #4

          This is how u have to place ur connectionstring in your app.config file.

          <configuration>
          <appSettings>
          <add key="DBConnString" value="Data Source=ervername;Initial Catalog=Databasename;User ID=userid;Password=password;"/>
          </appSettings>
          </configuration>

          For accessing this value from DB you can use this line of code in vb.net (in case of C# hope u can manage it, or ask me)

          Public Shared CONNECTSTRING As String = System.Configuration.ConfigurationSettings.AppSettings("DBConnString")

          Hope its fine and ur prob is solved.

          Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|

          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