Sunday 15 January 2012

Connect to local sql database in c# -


I am working on the C # .net application that needs to be connected to a simple database. This database is BTW in the same Visual Studio project and is called Playerdatabase.mdf .

In the application, I want to connect to the database using the following code:

  string connection string = "data source = (locali) \ v11.0; attachment debufflenname = C: \\ User \\ User 1 \\ Document \\ Visual Studio 2013 \ Projects \\ ProractTest \\ Prorctor Test \\ Playerdatabase.mdf; Integrated Security = True; Timeout Connect 30 "; SqlConnection con = new SqlConnection (connectionString); Con.Open ();  

But when I try to run the application and when it calls the open method, then I got an exception:

Additional information: 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 example name is correct and SQL

Inner exception: Network path can not be found

I looked on the way (by browsing it) and it looks fine Used to be. I have also read that the firewall tried to disable the work, but it got the same exception.

Is anyone's idea or suggestion? Any feedback is welcome!


No comments:

Post a Comment