title: Test Database Connection is OK before con.Open()
body: <p>I have created a generic Database handler class for my app. </p>
  
  <p>Im using a local database so <code>SqlCeConnection</code> class is being used here.</p>
  
  <p>What I would like to do is test that the Connection string is valid, so update the connection status to the user before I execute <code>connection.Open();</code></p>
  
  <p>lets say</p>
  
  <pre><code> SqlCeConnection conn = new SqlCeConnection(connectionString);
  
   //so far we have only created the connection, but not tried to open it
   //Would be nice to update the UI to say that conn is OK
   conn.testConnection();
  
   conn.Open();
  </code></pre>
  
  <p>I was thinking of writing a method that attempts to <code>open</code> then <code>close</code> the connection, am I right in thinking this or is there a better way.</p>