class ContactsRepository : IContactsRepository
{
private string connectionString = "Data Source=(LocalDB);Initial Catalog=Contact_DB;User ID=****;Password=**********";
public bool Delete(int ContactID)
{
throw new NotImplementedException();
}
public DataTable SelectAll()
{
string query = "Select * From MyContacts";
SqlConnection connection = new SqlConnection(connectionString);
Sql command = new SqlCommand(query, connection);
DataTable data = new DataTable();
adapter.Fill(data);
return data;
}
}
I get this error:
System.Data.SqlClient.SqlException: 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: 51 - An instance name was not specified while connecting to a Local Database Runtime. Specify an instance name in the format (localdb)\instance_name.