Invalid token in declaration

  • Thread starter Thread starter Andy Sutorius via DotNetMonster.com
  • Start date 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?
 
try:

NameValueCollection colNameVal =
System.Configuration.ConfigurationSettings.AppSettings;

instead of

colNameVal = System.Configuration.ConfigurationSettings.AppSettings;
 
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.
 
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

Back
Top