Question

On computer A my project is working fine, but on computer B I get a SQL exception:

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 instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Every time I call the CreateDatabse() method (from Database class that inherits from DataContext class).

I already tried to reinstall the whole SQL Server - but the exception remained. I have SQL Server 2012 installed. List of my SQL related programs installed:

List of my SQL-related programs installed

If it makes any difference, computer A is working under win8 and computer B on win7.

Database is created by program code:

String FOLDER_PATH = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ProgramName");
Directory.CreateDirectory(FOLDER_PATH);

String path = Path.Combine(FOLDER_PATH, "database.mdf");
Database db = new Database(path);

bool exists = db.DatabaseExists();

if (exists == false)
    db.CreateDatabase();

public class Database : DataContext
{
    public Table<Record> RecordTable;
    public Database(string connection) : base(connection) { }
}

edit: My problem is still unsolved. I've tried to reinstall MS SQL one more time, with no effect.

No correct solution

OTHER TIPS

This problem occurs when the connection string is not correctly configured or firewall on computer A is preventing SQLServer to work fine on the network...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top