Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > The variable 'configurationAppSettings' is either undeclared or was never assigned.

Reply
Thread Tools

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

 
 
hui
Guest
Posts: n/a
 
      10-13-2005
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(6: 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

 
Reply With Quote
 
 
 
 
Mohamed Sharaf
Guest
Posts: n/a
 
      10-13-2005

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
http://www.velocityreviews.com/forums/(E-Mail Removed) 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" <(E-Mail Removed)>
| 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: <(E-Mail Removed) .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: (E-Mail Removed)
| 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: (E-Mail Removed)
| 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(6: 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
|
|

 
Reply With Quote
 
 
 
 
hui
Guest
Posts: n/a
 
      10-14-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable is undeclared, but why? mailforpr@googlemail.com C++ 4 11-27-2006 07:17 PM
VB2005 - BugProof - The variable 'var' is either undeclared or was never assigned JulioNobre ASP .Net 0 09-26-2006 01:10 PM
undeclared loop variable Brad Smallridge VHDL 7 03-25-2005 07:45 PM
Position of variable declaration is causing "undeclared identifier" error. craigbeanhead C Programming 6 07-27-2003 02:25 AM
Position of variable declaration is causing "undeclared identifier" error. craigbeanhead C Programming 1 07-24-2003 10:19 PM



Advertisments