473,503 Members | 10,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The variable 'configurationAppSettings' is either undeclared or was never assigned.

hui
Here is a problem I am having with web form designer. I have a database
control in the form, and setup the connection string as a dynamic
property. It compiles and runs fine.

I close the aspx file, reopen it, and then have an error message in
task list: "\\xxx\wwwroot$\xxx\xx.aspx.cs(68): The variable
'configurationAppSettings' is either undeclared or was never assigned"

I open the code-behind file, and find out the trouble spot at the "web
designer generated code" region. The method looks like this:
private void InitializeComponent()
{
System.Configuration.AppSettingsReader configurationAppSettings =
new System.Configuration.AppSettingsReader();
.......
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString =
((string)(configurationAppSettings.GetValue("dbCon nection",
typeof(string))));
.......
}

Obviously the variable is declared and assigned locally. Go back to the
design editor, in the property window of the db connection control, the
dynamic property setting has disappeared. Yet, if I rebuild now, it
compiles and run just like before. If I any changes on the design
editor, the code-behind file is changed and the statement "
this.sqlConnection1.ConnectionString = ...." is wiped out. This is
definitely not what I want to see as I have to set it up again and
again.

Does anybody know whether it is a bug? Is there any fix or workaround?

Thanks

Nov 19 '05 #1
2 2222

Hi hui,
What's the version of Visual Studio you are using?
What's the type of the connection you are using, is it SqlConnection,
OledbConnection,....?
BTW: Avoid using your real email. You can use something like
mi********@anonymous.org or if you want it to be human readable. use
something like mild_roast_at_hotMail

Mohamed Sharaf
MEA Developer Support Center
ITWorx on behalf Microsoft EMEA GTSC
--------------------
| From: "hui" <mi********@hotmail.com>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: The variable 'configurationAppSettings' is either undeclared or
was never assigned.
| Date: 12 Oct 2005 22:03:27 -0700
| Organization: http://groups.google.com
| Lines: 37
| Message-ID: <11**********************@g49g2000cwa.googlegroups .com>
| NNTP-Posting-Host: 210.193.130.211
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google.com 1129179812 6582 127.0.0.1 (13 Oct 2005
05:03:32 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Thu, 13 Oct 2005 05:03:32 +0000 (UTC)
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
| X-HTTP-Via: 1.0 SYDPRX01
| Complaints-To: gr**********@google.com
| Injection-Info: g49g2000cwa.googlegroups.com;
posting-host=210.193.130.211;
| posting-account=i6V1NAwAAACRY9W_sJxyoOElwFrBeWVz
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!nntp.giganews. com!postnews.google.com!g4
9g2000cwa.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:131010
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Here is a problem I am having with web form designer. I have a database
| control in the form, and setup the connection string as a dynamic
| property. It compiles and runs fine.
|
| I close the aspx file, reopen it, and then have an error message in
| task list: "\\xxx\wwwroot$\xxx\xx.aspx.cs(68): The variable
| 'configurationAppSettings' is either undeclared or was never assigned"
|
| I open the code-behind file, and find out the trouble spot at the "web
| designer generated code" region. The method looks like this:
| private void InitializeComponent()
| {
| System.Configuration.AppSettingsReader configurationAppSettings =
| new System.Configuration.AppSettingsReader();
| ......
| //
| // sqlConnection1
| //
| this.sqlConnection1.ConnectionString =
| ((string)(configurationAppSettings.GetValue("dbCon nection",
| typeof(string))));
| ......
| }
|
| Obviously the variable is declared and assigned locally. Go back to the
| design editor, in the property window of the db connection control, the
| dynamic property setting has disappeared. Yet, if I rebuild now, it
| compiles and run just like before. If I any changes on the design
| editor, the code-behind file is changed and the statement "
| this.sqlConnection1.ConnectionString = ...." is wiped out. This is
| definitely not what I want to see as I have to set it up again and
| again.
|
| Does anybody know whether it is a bug? Is there any fix or workaround?
|
| Thanks
|
|

Nov 19 '05 #2
hui
FYI, the version I am using is vs.net 2003, version 7.1.3088. I am
using sqlconnection.

BTW, I think I've found the cause, but am not clear why. Under the
References folder in the Solution Explorer window, I set the "Copy
Local" property of System assembly to "true". As a result, the designer
couldn't function properly on the dynamic properties. Immediately after
I change it back to "false", such errors in the task list are all gone.
Change back to true, so comes back the same errors. It doesn't make
much sense to me, however.

Thanks,

Hui

Nov 19 '05 #3

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

Similar topics

4
4134
by: Chris Beall | last post by:
If you want your code to be bulletproof, do you have to explicitly check for the existence of any possibly-undefined variable? Example: window.outerHeight is defined by some browsers, but not...
134
7747
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
2
2026
by: ~~~ .NET Ed ~~~ | last post by:
It is not the first time I see this happen. I am using VS.NET 2003 with .NET Framework 1.1. In this particular situation I have a custom user control in a windows form. There is a member variable...
0
2706
by: Michael Howes | last post by:
I have a strange "warning" that shows up during design time in my current project. I have a UserControl, which contains a public enum called ViewTypes This UserControl also has a public property...
0
1457
by: VB Programmer | last post by:
I wanted to access some properties of a panel control that is on a different form. So, I went to the (Declarations) section of my main form (the form with the panel) and changed the panel (called...
4
5701
by: mros | last post by:
I've created three buttons on a form (IsMdiContainer=True), it's mdi parent. I need to disable these buttons from one of my child form. So, I've changed these buttons modifier to Friend Shared...
20
6929
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
6
6253
by: nsikkandar | last post by:
I created a Child Form and added several controls. One of the control is GroupBox1. When I want to change the access modifier property of the GroupBox1 FROM "Public WithEvents GroupBox3 As...
11
4377
by: =?UTF-8?Q?Filip_Gruszczy=C5=84ski?= | last post by:
Hello everyone! It is my first message on this list, therefore I would like to say hello to everyone. I am fourth year student of CS on the Univeristy of Warsaw and recently I have become very...
0
7207
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
7095
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...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.