T
Teemu Keiski
Hi,
first of all: *.config files are case.sensitive and second: to add key/value
settings, you'd use <add> element.
Your config should be:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="connectionstring"
value="server=(local);Trusted_Connection=yes;database=Northwind" />
</appSettings>
</configuration>
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
I have no idea why I get error message
An unhandled exception of type
'System.Configuration.ConfigurationException' occured in system.dll
Additional information: Unrecognised configuration section AppSettings
Here is the App.Config files details
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<AppSettings>
<Key="connectionstring" value="server=(local);Trusted_Connection=yes;
database=Northwind"/>
</AppSettings>
</configuration>
and all i want to do is to shoe the value of the connectiostring in a
message box in the form load event, as below.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MsgBox(System.Configuration.ConfigurationSettings.AppSettings.Get("connectio
nstring"))
End Sub
Surely its not that difficult to spot what I am doing wrong I have copied
and recopied this out time and time again but still cannot read the key
value in the event????
David
first of all: *.config files are case.sensitive and second: to add key/value
settings, you'd use <add> element.
Your config should be:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="connectionstring"
value="server=(local);Trusted_Connection=yes;database=Northwind" />
</appSettings>
</configuration>
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
I have no idea why I get error message
An unhandled exception of type
'System.Configuration.ConfigurationException' occured in system.dll
Additional information: Unrecognised configuration section AppSettings
Here is the App.Config files details
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<AppSettings>
<Key="connectionstring" value="server=(local);Trusted_Connection=yes;
database=Northwind"/>
</AppSettings>
</configuration>
and all i want to do is to shoe the value of the connectiostring in a
message box in the form load event, as below.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MsgBox(System.Configuration.ConfigurationSettings.AppSettings.Get("connectio
nstring"))
End Sub
Surely its not that difficult to spot what I am doing wrong I have copied
and recopied this out time and time again but still cannot read the key
value in the event????
David