K
Karl Lang
Hi
I've created a new configuration section in Web.Config to hold the
connection string for my database. If I have Option Strict On I get a
message "Option Strict On disallows late binding" when I try to retrieve the
string. Now I'd rather not turn off option strict but I'd also prefer to
have my connection string in one place. Does anyone have any ideas where I'm
going wrong with this?
This is the code
In Web.Config (I've removed some of the type in the section name):
<configSections>
<section name="MyWebSite"
type="System.Configuration.NameValueFileSectionHandler..." />
</configSections>
<MyWebSite>
<add key="connString"
value="server=(local);uid=x.xxx;pwd=xxx;database=xyzxyz" />
</MyWebSite>
In my ASPX file, the following produces the late binding error message:
strConn = ConfigurationSettings.GetConfig("MyWebSite")("connString")
klang
I've created a new configuration section in Web.Config to hold the
connection string for my database. If I have Option Strict On I get a
message "Option Strict On disallows late binding" when I try to retrieve the
string. Now I'd rather not turn off option strict but I'd also prefer to
have my connection string in one place. Does anyone have any ideas where I'm
going wrong with this?
This is the code
In Web.Config (I've removed some of the type in the section name):
<configSections>
<section name="MyWebSite"
type="System.Configuration.NameValueFileSectionHandler..." />
</configSections>
<MyWebSite>
<add key="connString"
value="server=(local);uid=x.xxx;pwd=xxx;database=xyzxyz" />
</MyWebSite>
In my ASPX file, the following produces the late binding error message:
strConn = ConfigurationSettings.GetConfig("MyWebSite")("connString")
klang