Invalid token in declaration

  • Thread starter Andy Sutorius via DotNetMonster.com
  • Start date
A

Andy Sutorius via DotNetMonster.com

With this line (asp.net/c#):
colNameVal = System.Configuration.ConfigurationSettings.AppSettings;
I get "invalid token '=' in declaration". I also get it for "invalid token
';' in declaration".
I don't understand what the compiler is trying to say. Can you clarify/solve?
 
G

Gabriel Magaña

try:

NameValueCollection colNameVal =
System.Configuration.ConfigurationSettings.AppSettings;

instead of

colNameVal = System.Configuration.ConfigurationSettings.AppSettings;
 
G

Gabriel Magaña

It would also help if you could display the line immediately before the line
you showed. It could be missing a semicolon, or have somethign wrong with
it.
 
A

Andy Sutorius via DotNetMonster.com

Thank you for your help I found the solution. I had the namevaluecollection
and the appsettings line in the class. I moved it to the button onclick and
it worked. I looked up the error code in the ms library and it gave me a clue
what the compiler was asking me to do.
It would also help if you could display the line immediately before the line
you showed. It could be missing a semicolon, or have somethign wrong with
it.
[quoted text clipped - 4 lines]
colNameVal = System.Configuration.ConfigurationSettings.AppSettings;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top