database location change
-
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 !
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
-
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 !
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 ...
-
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 ...
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 !
-
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 !
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
-
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
-
strange try setting scope to application and not user (if not already like that)
-
strange try setting scope to application and not user (if not already like that)
-
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.
-
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.
-
Same problem : My.Settings.MyConnectionString = str My.Settings.Save() Error "Property MyconnectionString is readonly"
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.