By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.