473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

option strict disallows late binding reading from web.config

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.NameValueFileSectionHan dler..." />
</configSections>

<MyWebSite>
<add key="connString"
value="server=(local);uid=x.xxx;pwd=xxx;database=x yzxyz" />
</MyWebSite>

In my ASPX file, the following produces the late binding error message:
strConn = ConfigurationSettings.GetConfig("MyWebSite")("conn String")

klang
Nov 18 '05 #1
1 1616

"Karl Lang" <kl***@NOSPAM.EXAMPLE.COM> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
In Web.Config (I've removed some of the type in the section name):
<configSections>
<section name="MyWebSite"
type="System.Configuration.NameValueFileSectionHan dler..." />
</configSections>


Hi again,
you can ignore my post, after re-reading the online docs I have used
appSettings section to hold my connection string.

btw, it also appears that I shouldn't have used NameValueFileSectionHandler.
If anyone is interested in section groups check out Declaring and Accessing
Section Groups at msdn,
http://msdn.microsoft.com/library/de...tiongroups.asp

klang
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Dieter Schwerdtfeger via DotNetMonster.com | last post by:
I have this function where i search through my database for items that were made on a specific date. The line "CType(dvClubs.Item(teller).Item(veld).ToShortDateString" gives me the error : option...
3
by: Starbuck | last post by:
Hi The following generates an error when Option Strict is On Can anytell tell me how to get round this please. Private Sub optWithTone_CheckedChanged(ByVal eventSender As System.Object, ByVal...
7
by: CodeMonkey | last post by:
Hi All the following code generates an error with option strict on - Option strict disallows late binding. Can someone please help with what needs to be changed: Dim sweep, totalsweep As...
4
by: Heinz | last post by:
Hi all, I use VB.net 2003 and want to export data to Excel. Target PCs still have Office 2000 so I could not use Microsofts PIAs. Instead I use the included Excel 10 COM DLL from Microsoft....
9
by: YYZ | last post by:
After reading many messages in this group, it seems that the preferred setting for this is ON. Okay, I did that in my project (first with ..Net -- long time VB6 developer) and now a bunch of...
7
by: Owen Mortensen | last post by:
(This code was working in asp.net 1.1 VS2003. After upgrade to VS2005, chokes): in the aspx file: <ItemTemplate> <asp:datagrid id="dg_instr" runat="server" AutoGenerateColumns="False"...
1
by: Adotek | last post by:
Hi All, I've just converted a solution from .Net v1.1 to v2.0, by allowing Visual Studio 2005 to do the conversion. Since doing so, I am getting a compilation error as follows: "Option...
6
by: Rob | last post by:
I have employed a "Singleton mode" of programming for this project. I have a class that exposes some properties of the class "Sample" to other forms.... If I set Option Strict On, I get many...
7
by: Lynn | last post by:
Hello, I have a website that is working fine. I have just turned on "option strict" and am getting an error with the parts of my code. I have fixed everything but this section, which has me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.