ASWIN KUMAR

ASWIN KUMAR

  • NA
  • 8
  • 1.1k

'ObjConn_serverversion' threw an exception

Apr 15 2015 6:32 AM
Hello,

I am trying to connect to the Database from the application and its not happening at all. The same DLL is working fine in QA and production.


When debugging I understood the SQL connection is always closed.

when I checked the below line of code,

public static SqlConnection objConn = new SqlConnection(strConnStr);

For objConn I was able to see an exception "'ObjConn_serverversion' threw an exception of type System.InvalidOperationException" and the state was CLOSED.

Please let us know whether you can help me with this.

Connection String:


During debug I found the below error message in objConn
public static SqlConnection objConn = new SqlConnection(strConnStr);

ServerVersion --> 'objConn.ServerVersion' threw an exception of type 'System.InvalidOperationException'

State --> Closed

Source code was initially developed in VS 2008. Now when I opened the solution it automatically takes me to Visual studio 2010 Conversion wizard, I am not sure whether this is something to do with this.