Where to set ConfigurationSettings.AppSettings? [Resolved]
Where can I set the ConnectionString that is referred to in this line of code?
VB Code:
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Here is original link with full code:
http://authors.aspalliance.com/das/insertimage.html
From this article:
http://aspalliance.com/articleViewer.aspx?aId=138&pId=
Thanks!
Re: Where to set ConfigurationSettings.AppSettings?
Dave, ConfigurationSettings sounds like its the name of the project and AppSettings is the name of a class? Its probably grabbing
the ConnectionString property from that class. I noticed that the article refers to it on other examples too but without
definition. You could probably re-create it if you cant find it on thir site.
Re: Where to set ConfigurationSettings.AppSettings?
Re: Where to set ConfigurationSettings.AppSettings?
I don't have a .CONFIG file. Its a stand-alone .ASPX file.
Re: Where to set ConfigurationSettings.AppSettings?
web.config, to be specific.
Code:
<configuration>
<appSettings>
<add key="ConnectionString"
value="sdlfkjaslfkjasdlfkjasdlfkjasdflk" />
</appSettings>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Re: Where to set ConfigurationSettings.AppSettings?
How can I associate a .CONFIG file to this stand-alone .aspx file? When I open the .aspx file in vis stud, it doesn't make a Solution or Project. There is just the file... Any pointers greatly appreciated.
Re: Where to set ConfigurationSettings.AppSettings?
Quote:
Originally Posted by Dave Sell
I don't have a .CONFIG file. Its a stand-alone .ASPX file.
Then you might as well store your connection string in a variable and forget about configurationsettings.
Re: Where to set ConfigurationSettings.AppSettings?
We're talking out of sync ;)
Create a new web project and add the aspx file to the solution.
Or just copy over the aspx and code to the existing .aspx in the new solution.
Re: Where to set ConfigurationSettings.AppSettings?
Just make sure the page directive isn't copied over.
Re: Where to set ConfigurationSettings.AppSettings?
Mendhak's advice was right-on. kudos! Thanks all!