问题描述
您好,
我正在尝试从应用程序连接到数据库,而它根本没有发生。相同的DLL在QA和生产中工作正常。
调试时我知道SQL连接总是关闭。
当我检查下面的代码行时,
public static SqlConnection objConn = new SqlConnection(strConnStr);
对于objConn我能够看到一个异常'ObjConn_serverversion'抛出System.InvalidOperationException类型的异常并且状态为CLOSED。
请告诉我们您是否可以帮助我。
连接字符串:
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:
<add name="Connection" connectionstring="Data Source=xxx;Initial Catalog=xxx;Integrated Security=True;Trusted_Connection=true" providername="System.Data.SqlClient" />
在调试过程中,我在objConn中发现了以下错误信息
During debug I found the below error message in objConn
public static SqlConnection objConn = new SqlConnection(strConnStr);
ServerVersion - > 'objConn.ServerVersion'引发了'System.InvalidOperationException'类型的异常
状态 - >关闭
源代码最初是在VS 2008中开发的。现在,当我打开解决方案时,它会自动转到Visual Studio 2010转换向导,我不确定这是否是与此有关。
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.
推荐答案
这篇关于'ObjConn_serverversion'抛出了System.InvalidOperationException类型的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!