Chcę sprawdzić, czy serwer nie jest dostępny i jeśli nie jest dostępny, chcę wydrukować przyjazny komunikat na mojej stronie logowania. Podobnie jak w przypadku wprowadzenia przez użytkownika danych uwierzytelniających i wyjątku, otrzymałem ten wyjątek od Jak uzyskać Typ wyjątku w C#
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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
. W jaki więc sposób powinienem wskazać, kiedy wystąpi wyjątek, aby wyświetlić komunikat?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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
serwera? Serwer bazy danych? serwer sieciowy? jakie środowisko? pytanie nie jest wcale jasne. – vulkanino
To C++ jest C# – PostMan
@vulkanino: Wyjątek, który piszę w moim pytaniu, wyraźnie sugerujący, jaki typ wyjątku otrzymuję ... jego związany z serwerem bazy danych –