1. If it's Microsoft SQL Server Express you should try the following:
Server=(localdb)\v11.0;Integrated Security=true;
AttachDbFileName=C:\MyFolder\MyData.mdf;
public void LoadDB()
{
conDB = new SqlConnection();
conDB.ConnectionString = @"Server=(localdb)\v11.0;
Integrated Security=True;
AttachDbFilename=C:\EPL.mdf";
conDB.Open();
}
This should work for you.
2. Do you use SQL server or Windows authentication ? If you're using SQL server authentication
in your connection string I believe that you should also provide: User ID=myUsername; Password=myPassword; :
public void LoadDB()
{
conDB = new SqlConnection();
conDB.ConnectionString = @"Server=(localdb)\v11.0;
Integrated Security=True;
AttachDbFilename=C:\EPL.mdf;
User ID=myUsername;
Password=myPassword";
conDB.Open();
}