title: What would be the most convenient way to connect Visual Studio 2005 (C#) to Oracle8?
body: <p>I'm looking for best practices for establishing connections between Oracle 8 and Visual Studio 2005 applications. The target would be a Windows Forms application written in C# that hits the database once a second to monitor tables looking for their last inserted record. I'm considering using "Application settings" to store the connection string there, but I'd love to hear from you guys. Thanks in advance!</p>
  
  <p>This is a very rudimentary draft:</p>
  
  <pre><code>using System.Data;
  using System.Data.OracleClient;
  
          try
          {
              StringBuilder str = new StringBuilder();
              string ora = Properties.Settings.Default.OracleConnectionString;
  
              OracleConnection con = new OracleConnection(ora);
              OracleCommand cmd = new OracleCommand();
  
              cmd.Connection = con;
              cmd.CommandText = "SELECT timestamp FROM jde_out WHERE rownum = 1";
              cmd.CommandType = CommandType.Text;
  
              con.Open();
              OracleDataReader rdr = cmd.ExecuteReader();
              rdr.Read();
  
              str.AppendLine(cmd.ExecuteScalar().ToString());
              this.lblJDEtime.Text = str.ToString();
              rdr.Close();
              con.Close();
          }
          catch (OracleException err)
          {
              MessageBox.Show("Exception caught:\n\n" + err.ToString());
          }
  </code></pre>
  
  <p>I've just updated the code needed to perform the connection. Changed the Exception type to the more specific OracleException. Added the connection string via Properties.Settings.</p>