how to fix the underlying provider failed on open entity framework c# sql server 2014 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" />