Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
I'm working on a school project. This project is being built in C# windows forms , Entity framework and SQL Server 2008.I want to know if someone want to check on the start of project running that either the database file is properly attached to project or not, how we can do it using C# or entity framework.
Posted

1 solution

There are ways to detect what servers / SQL services are available, but I'd suggest you try to perform some query with a try/catch and check any exceptions. You'll soon find the one that says "unable to connect to SQL server". Then you know it's unavailable.

How does that sound?
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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