System.Data.Entity.Core.EntityException: 'The underlying provider failed on Open.' code example

Example 1: System.Data.Entity.Core.EntityException: The underlying provider failed on Open

<add name="ConnectionStringName"
    providerName="System.Data.SqlClient"
    connectionString="Data Source=ServerName\InstanceName;Initial Catalog=DatabaseName;    Integrated Security=True;MultipleActiveResultSets=True" />

Example 2: System.Data.Entity.Core.EntityException: The underlying provider failed on Open

<add name="ConnectionStringName"
    providerName="System.Data.SqlClient"
    connectionString="Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=False;    User Id=userid;Password=password;MultipleActiveResultSets=True" />