title: How to Write data to Sql Table from SharePoint WebPart when DB and SP are on different machine?
body: <p>I am working on SharePoint 2013. Database is on SqlServer 2008R2. Both SP and DB are on different machines. I am creating a webPart which is associated with usercontrol. I'm writing the logic in cs file of usercontrol, to write data collected from the form into Data table of sql server.  </p>
  
  <pre><code>Connection string: Server=myServerAddress;Database=myDataBase;User
  Id=myUsername; Password=myPassword;
  </code></pre>
  
  <p>But it is failing and throwing an error like "Login failed for user".</p>
  
  <p>Please guide.</p>