此代码在VS 2010和2012中完美运行。
Dim cmdText As String = "select * from master.dbo.sysdatabases where name=N'" & database & "'"
Dim bRet As Boolean = False
Using sqlConnection As SqlConnection = New SqlConnection(connString)
Try
sqlConnection.Open()
Using sqlCmd As SqlCommand = New SqlCommand(cmdText, sqlConnection)
Using reader As SqlDataReader = sqlCmd.ExecuteReader
bRet = reader.FieldCount > 1
reader.Close()
End Using
End Using
Catch ex As SqlException
MsgBox("Error Trying to Connect to database " & database & vbNewLine & ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
sqlConnection.Close()
End Try
End Using
但是当我在2013年运行它时,这是我在sqlConnection.Open()命令中得到的错误: -
“System.ExecutionEngineException”类型的未处理异常 发生在System.Transactions.dll
中如果存在此异常的处理程序,则程序可能是安全的 继续进行。
我找到并试过http://connect.microsoft.com/VisualStudio/feedback/details/791339/fatalexecutionengineerror
但无济于事
有没有人指点?
我被卡住了。