Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi when connect to sql in page cs with entity to linq
C#
using(Hrst temp=new Hrst())
              {
                  var t = temp.F_News_show_User();
                  if (t != null)
                  {
                      Repeater1.DataSource = t;
                      Repeater1.DataBind();
                  }
                  else
                  {
                      LMsg.Visible = true;
                      LMsg.Text = "asdas";
                  }

              }

i need check For any reason (Stop the database instance) Do not connect to the database
this error and show Appropriate message.
this error when stop sqlserver
HTML
The system cannot find the file specified
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)
Posted
Comments
Prasad Avunoori 10-Sep-14 2:14am    
Use exception handling and capture the specific exception then show that message to user.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900