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. database location change

database location change

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasesysadminhelp
11 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.
  • P progalx

    I have this problem :I have developped a application in vb.net.This application use a microsoft Access database.I have used data wizard to create the connection , dataset , etc.But now there is a problem in our company : There are several Access Databases on some network computers and we want to work with these databases on my application.All the databases are identical . Now how can modify my application to make possible for users to choose one of this databases and to work with it. I don't knoth if is possible to change the connection string ? Or there is another way ? Thank you in advance !

    P Offline
    P Offline
    Paul Conrad
    wrote on last edited by
    #2

    You should be able to have multiple connection strings in the app.config file, if you are going that route.

    "The clue train passed his station without stopping." - John Simmons / outlaw programmer

    1 Reply Last reply
    0
    • P progalx

      I have this problem :I have developped a application in vb.net.This application use a microsoft Access database.I have used data wizard to create the connection , dataset , etc.But now there is a problem in our company : There are several Access Databases on some network computers and we want to work with these databases on my application.All the databases are identical . Now how can modify my application to make possible for users to choose one of this databases and to work with it. I don't knoth if is possible to change the connection string ? Or there is another way ? Thank you in advance !

      T Offline
      T Offline
      Tom Deketelaere
      wrote on last edited by
      #3

      store the connectionstring in the settings file (property's of project -- settings) then you can access this setting like my.settings.'what you provided for name' you can add multiple connectionstrings if you want you can create a form on wich the user select the db and you then create the connectionstring and store it to the settings ...

      P 1 Reply Last reply
      0
      • T Tom Deketelaere

        store the connectionstring in the settings file (property's of project -- settings) then you can access this setting like my.settings.'what you provided for name' you can add multiple connectionstrings if you want you can create a form on wich the user select the db and you then create the connectionstring and store it to the settings ...

        P Offline
        P Offline
        progalx
        wrote on last edited by
        #4

        Thank you The databases are on different computers , later we can add new databases on other computers , the location of databases may change so is not possible to create multiple connectionstrings. I like the idea to create a form where user to select the database and then to create the connection string. But , how to create and store the connection string in the settings file ? Can you give me some code to do this ? Thank you !

        T 1 Reply Last reply
        0
        • P progalx

          Thank you The databases are on different computers , later we can add new databases on other computers , the location of databases may change so is not possible to create multiple connectionstrings. I like the idea to create a form where user to select the database and then to create the connection string. But , how to create and store the connection string in the settings file ? Can you give me some code to do this ? Thank you !

          T Offline
          T Offline
          Tom Deketelaere
          wrote on last edited by
          #5

          to create a connection string in the settings file: go to project -- property's -- settings tab there you can add a string (call it connectionstring (or somthing else)) or a connectionstring type value (I sugest a string since you want to easily alter it) to save the connection string: my.settings.connectionstring (or something else ;P) = "a connectionstring" my.settings.save ' normally not needed but just to be on the save side then use the connnectionstring : dim s as string = my.settings.connectionstring make sure that you set the connectionstring setting before you use it (otherwise you'll get a nice error and crash ;P) this should do it

          P 1 Reply Last reply
          0
          • T Tom Deketelaere

            to create a connection string in the settings file: go to project -- property's -- settings tab there you can add a string (call it connectionstring (or somthing else)) or a connectionstring type value (I sugest a string since you want to easily alter it) to save the connection string: my.settings.connectionstring (or something else ;P) = "a connectionstring" my.settings.save ' normally not needed but just to be on the save side then use the connnectionstring : dim s as string = my.settings.connectionstring make sure that you set the connectionstring setting before you use it (otherwise you'll get a nice error and crash ;P) this should do it

            P Offline
            P Offline
            progalx
            wrote on last edited by
            #6

            i get an error : Property is readonly

            T 1 Reply Last reply
            0
            • P progalx

              i get an error : Property is readonly

              T Offline
              T Offline
              Tom Deketelaere
              wrote on last edited by
              #7

              strange try setting scope to application and not user (if not already like that)

              P 1 Reply Last reply
              0
              • T Tom Deketelaere

                strange try setting scope to application and not user (if not already like that)

                P Offline
                P Offline
                progalx
                wrote on last edited by
                #8

                The same message "ConnectionString propert is readonly"

                M 1 Reply Last reply
                0
                • P progalx

                  The same message "ConnectionString propert is readonly"

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

                  The setting may be marked as an application setting, set it to a user setting. This should allow you to change the setting from your code.

                  P 1 Reply Last reply
                  0
                  • M Mycroft Holmes

                    The setting may be marked as an application setting, set it to a user setting. This should allow you to change the setting from your code.

                    P Offline
                    P Offline
                    progalx
                    wrote on last edited by
                    #10

                    Same problem : My.Settings.MyConnectionString = str My.Settings.Save() Error "Property MyconnectionString is readonly"

                    M 1 Reply Last reply
                    0
                    • P progalx

                      Same problem : My.Settings.MyConnectionString = str My.Settings.Save() Error "Property MyconnectionString is readonly"

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

                      In Visual Studio Open the solution explorer pane under your project name you will see "My Project" Double click in the main pane select the settings tab identify the conection string setting and check the scope - this should be user and NOT application.

                      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