title: Windows server 2012R2 Classic ASP Microsoft OLE DB Provider for SQL Server error '80040e4d'
body: <p>I have a classic ASP application which has been moved to windows server 2012R2 two days before and sice then its showing a connection error in some sections of the application.</p>
  
  <p>Microsoft OLE DB Provider for SQL Server error '80040e4d' Login failed for user 'sa'. </p>
  
  <p>Login and some listing functionality are working fine but when Im accessing a billing page its showing the above mentioned error and we are using the same DB connection in the billing page also.</p>
  
  <p>Following is the connection string used</p>
  
  <pre><code>Dim datasource,cnnCompanyDbase
  Set cnnCompanyDbase=Server.CreateObject("ADODB.Connection")
  cnnCompanyDbase.Open "Provider=SQLOLEDB;Initial Catalog=CompanyDatabase;Data Source=192.168.0.20;User Id=sa; Password=satest;"
  </code></pre>
  
  <p>Previously the application was running fine on windows server 2003.</p>
  
  <p><strong>Edit</strong>
  After going through the code in detail, I found there is some slight difference in the record set opening with the DB command object.</p>
  
  <p>Following is the two scenario</p>
  
  <p><strong>Working Condition</strong></p>
  
  <pre><code>qryStaff="SELECT * FROM [Staff]"
  
  Set rstStaff=Server.CreateObject("ADODB.Recordset")
  rstStaff.CursorType = adOpenStatic
  rstStaff.Open qryStaff,cnnCompanyDbase
  </code></pre>
  
  <p><strong>Error condition</strong></p>
  
  <pre><code>qryJobClients = "SELECT Client FROM Jobs WHERE Jobs.[Job-billing]=3"
  Set rstJobClients=Server.CreateObject("ADODB.Recordset")
  rstJobClients.CursorType = adOpenStatic 
  rstJobClients.Open qryJobClients,getDBConnect()
  </code></pre>
  
  <p>In the above case the method getDBConnect() returns the cnnCompanyDbase. I have printed both and getting the exact value, only the difference is one is from a method and another is directly given DB command. </p>