Solved

Storing a Connection String in My.Settings?

Posted on 2014-09-16
6
79 Views
Last Modified: 2014-09-17
I have not used the My.Settings feature very much so I'm not clear on all it's rules.

I have a setting called "strDBConnection" established in My.Settings. It's defined as "Connection String" along with it's value.

In design mode, I have a statement that won't work (see attachment). How do I resolve this?

Thanks!
Screenshot.jpg
0
Comment
Question by:BlakeMcKenna
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:Andrea Antonangeli
ID: 40325678
You must define the setting as "User" to avoid the readonly attribute of the property you define in My.Settings

You probably have defined it as "Application"
0
 

Author Comment

by:BlakeMcKenna
ID: 40325715
Yes, I do but I need the scope of that variable to be "Application". Is there a way to dynamically set that setting "strDBConnection" to where it will persist until changed again?
0
 
LVL 1

Expert Comment

by:Andrea Antonangeli
ID: 40325831
I'm afraid there is no way to change the value of "strDBConnection" if you define it as "Appication".
It is Readonly by design.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:BlakeMcKenna
ID: 40326053
Actually, you can do it. I've seen the code before but don't have it nor do I remember it...
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40327319
Connection strings should really go in the <connectionStrings> section of your app.config--it's a commonly accepted convention. You can access the values by way of:

Dim conString As String = System.Configuration.ConfigurationManager.ConnectionStrings("con string name").ConnectionString

Open in new window


...once you've added a reference to System.Configuration.dll.
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 40327951
Thanks KaufMed...that worked great!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question