title: connect to database c#
body: <p>I'm trying to connect to a DB on a server using C# but with no luck.</p>
  
  <p>I tried using this:</p>
  
  <pre><code>public static string m_ConnectionString =
      @"Network Library=dbmssocn; Data Source=*server ip*,*port*; database=*db name*; " +
      @"User id=*db username*; Password=*db pass*;";
  public static SqlConnection myConnection = new SqlConnection(m_ConnectionString);
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Connection Timeout Expired.  The timeout period elapsed while
    attempting to consume the pre-login handshake acknowledgement.  This
    could be because the pre-login handshake failed or the server was
    unable to respond back in time.  The duration spent while attempting
    to connect to this server was - [Pre-Login] initialization=9343;
    handshake=5654;</p>
  </blockquote>
  
  <p>when I used <code>myConnection.Open();</code></p>
  
  <p>I tried also to set the timeout to <code>int.MaxValue</code> and it didn't work.</p>