Hi folks, I have set the appSettings Tag in the web.config file to hold my database connection string.
Like so:
______________
<appSettings>
<add key="strConn" value="Provider = Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\ ID=Admin;Password=;" />
</appSettings>
<system.web>
_______________
But when I try to use the following line in the code behind I get the following error message:
code:
_________
OleDbConnection MyConn = new OleDbConnection(ConfigurationSettings.AppSettings("strConn"));
__________
Error Message:
______________
'System.Configuration.ConfigurationSettings.AppSettings' denotes a 'property' where a 'method' was expected
______________
Now I have used the same method in VB.Net and it works fine, but this error message has be completely stumped.
I appreciate any assistance with this.
Thanks
_________________
Paladine
Like so:
______________
<appSettings>
<add key="strConn" value="Provider = Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\ ID=Admin;Password=;" />
</appSettings>
<system.web>
_______________
But when I try to use the following line in the code behind I get the following error message:
code:
_________
OleDbConnection MyConn = new OleDbConnection(ConfigurationSettings.AppSettings("strConn"));
__________
Error Message:
______________
'System.Configuration.ConfigurationSettings.AppSettings' denotes a 'property' where a 'method' was expected
______________
Now I have used the same method in VB.Net and it works fine, but this error message has be completely stumped.
I appreciate any assistance with this.
Thanks
_________________
Paladine