locked
Not allowed to change the 'ConnectionString' property. The connection's current state is open.

    Question

  • A particular user is getting

    "Not allowed to change the 'ConnectionString' property. The connection's current state is open."

    Whereas it works fine for rest of the users. Any idea?

    Thank you

    Hari.


    Haricharan.

    Tuesday, October 16, 2012 5:56 PM

Answers

  • Are you assigning the connection string at runtime?

    Before assigning connection string to your connection object make sure your connection object is closed or it is not opened. i.e

    sqlconn.Close();
    sqlconn.ConnectionString = "provider ........ ";

    Or check the state of your SQL Connection before assigning connection string i.e.

    If( sqlconn.State == ConnectionState.Closed)
    {
    sqlconn.ConnectionString = "provider ........ ";
    }

    The reason only specific user is getting this error may be – a specific code block is executing by a specific pattern by user. As you did not share your code it is difficult for someone to tell you the real reason.

    You can find out the faulty code and follow above suggestion to solve this issue.


    Lingaraj Mishra

    Wednesday, October 17, 2012 5:39 AM