Invalid token in declaration

Discussion in 'ASP .Net' started by Andy Sutorius via DotNetMonster.com, Jan 24, 2006.

  1. 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?

    --
    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200601/1
     
    Andy Sutorius via DotNetMonster.com, Jan 24, 2006
    #1
    1. Advertising

  2. try:

    NameValueCollection colNameVal =
    System.Configuration.ConfigurationSettings.AppSettings;

    instead of

    colNameVal = System.Configuration.ConfigurationSettings.AppSettings;
     
    Gabriel Magaña, Jan 24, 2006
    #2
    1. Advertising

  3. 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.

    "Gabriel Magaña" <> wrote in message
    news:%23KX$...
    > try:
    >
    > NameValueCollection colNameVal =
    > System.Configuration.ConfigurationSettings.AppSettings;
    >
    > instead of
    >
    > colNameVal = System.Configuration.ConfigurationSettings.AppSettings;
    >
    >
     
    Gabriel Magaña, Jan 24, 2006
    #3
  4. 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.

    Gabriel Magaña wrote:
    >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.
    >
    >> try:
    >>

    >[quoted text clipped - 4 lines]
    >>
    >> colNameVal = System.Configuration.ConfigurationSettings.AppSettings;


    --
    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200601/1
     
    Andy Sutorius via DotNetMonster.com, Jan 24, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Williams
    Replies:
    2
    Views:
    1,136
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. Cronus
    Replies:
    1
    Views:
    675
    Paul Mensonides
    Jul 15, 2004
  3. G Fernandes
    Replies:
    1
    Views:
    529
  4. Wessi
    Replies:
    3
    Views:
    858
    Lawrence Kirby
    Aug 11, 2005
  5. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    This is an unexpected token. The expected token is 'NAME'

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Jul 13, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    784
    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=
    Jul 13, 2007
Loading...

Share This Page