我SqlException
在 .NET 3.5 应用程序的日志中得到一个,我正在寻找相应的数字(属性的值SqlException.Number
)。
System.Data.SqlClient.SqlException: A transport-level error has occurred
when receiving results from the server. (provider: TCP Provider, error: 0
- The specified network name is no longer available.) at
System.Data.SqlClient.SqlConnection.OnError
我也收到错误,例如:
System.Data.SqlClient.SqlException: A network-related or instance-specific error
occurred while establishing a connection to SQL Server. The server was not found
or was not accessible. Verify that the instance name is correct and that SQL Server
is configured to allow remote connections.
有谁知道如何正确捕获这些异常?(你也可以在这里发布你的答案)