我在 .NET 3.5 应用程序的日志中发现了一个 SqlException
,我正在寻找相应的编号(即属性 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.
有人知道如何正确捕获这些异常吗?(您还可以在此处发布您的回答https://stackoverflow.com/questions/380547/a-list-of-common-sqlexception-numbers)