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. Sql Connection1

Sql Connection1

Scheduled Pinned Locked Moved Visual Basic
databasecsharpquestionlearning
4 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.
  • L Offline
    L Offline
    LordLothar
    wrote on last edited by
    #1

    I am using sqlconnection control in vb.net and i use it for different form. Everytime if i move my database and my application to other Computer, I need to change the connection string one by one in each form and of course this is abit troublesome for me. Any ways to change the sqlconnection string in properties only 'once', and all sqlconnection string in all forms will also change?

    M 1 Reply Last reply
    0
    • L LordLothar

      I am using sqlconnection control in vb.net and i use it for different form. Everytime if i move my database and my application to other Computer, I need to change the connection string one by one in each form and of course this is abit troublesome for me. Any ways to change the sqlconnection string in properties only 'once', and all sqlconnection string in all forms will also change?

      M Offline
      M Offline
      Muhammad Waqas Butt
      wrote on last edited by
      #2

      Hey Buddy you must use app.config file. If you do need an example i will provide you ok. Wait Bye... Muhammad Waqas Butt waqasb4alll@yahoo.com

      L 1 Reply Last reply
      0
      • M Muhammad Waqas Butt

        Hey Buddy you must use app.config file. If you do need an example i will provide you ok. Wait Bye... Muhammad Waqas Butt waqasb4alll@yahoo.com

        L Offline
        L Offline
        LordLothar
        wrote on last edited by
        #3

        I would love to see the example. Sorry for double posting thread

        M 1 Reply Last reply
        0
        • L LordLothar

          I would love to see the example. Sorry for double posting thread

          M Offline
          M Offline
          Muhammad Waqas Butt
          wrote on last edited by
          #4

          Here is Code Buddy... First add App.config file into your project. [1] Add below code in the App.config How to get the key value. code is: First add system.configration; reference is the file. then add this code on you button click. try { string consetting = ConfigurationSettings.AppSettings["constr"]; // Get the Key value from app.config. // I'm not good in VB.Net but still a try In VB.Net get key value could like this // String consetting As ConfigurationSettings.AppSettings["constr"] txtconstr.Text = consetting; } catch(Exception ex) { MessageBox.Show("Exception : " + ex.Message, "Muhammad Waqas Butt", MessageBoxButtons.OK, MessageBoxIcon.Information); } } See how simple is to do. Ok please inform me if any problem occure in this code ok Muhammad Waqas Butt:-> waqasb4all@yahoo.com

          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