none
field initializer cannot reference non static field.method, or property

    Question

  • class GenralClass
    {
    StreamReader Sdr=new StreamReader(Application.StartupPath +" /connection.txt");
    public SqlConnection con = new SqlConnection(Sdr.ReadLine());

    }

    In the above code "Sdr.ReadLine()" as error shown like "field initializer cannot reference non static field.method, or property"

    I use class file in c#...

    pls any one can help me..

    Mankatha

    Wednesday, March 07, 2012 3:29 AM

Answers

All replies