c# - Connecting to localdb with Visual Studio and NUnit -


i'm trying run unit tests out of nunit centered around databases. tests access localdb nunit keeps giving errors. i've set localdb (or think), sql command isn't recognizing it.

exception occurred while deleting table: network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 50 - local database runtime error occurred. specified localdb instance not exist.

here path sql command in unit test:

private const string connectionstring_ = "data source=(localdb)\\projects;initial catalog=metricsbusdatabase;integrated security=sspi;"; 

i've read on of related sql questions , i'm reinstalling sql server. no 1 seems getting same error. suspect i've missed simple.

the connection string not right. not see "attachdbfilename" part points mdf file represents local db.

try this:

connectionstring=@"data source=(localdb)\v11.0;attachdbfilename=path_to_mdf.mdf;initial catalog=metricsbusdatabase;integrated security=sspi;"; 

or see this response similar problem.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -