title: How to get detailed ExecuteNonQuery error message?
body: <p>I'm working on my first ever assignment in ASP.NET. It's a website and I work in Visual Studio. </p>
  
  <p>What I can't figure out is how to get a detailed error message to be displayed when ExecuteNonQuery fails.</p>
  
  <p>I'm using OleDb connection, so my guess is I have to use OleDbException or OleDbError to get a detailed error message.</p>
  
  <p>Basically, the question is - how do I update this code to have a detailed error message IF ExecuteNonQuery fails?</p>
  
  <pre><code>string v1 = Request["v1"];                                    
  string v2 = Request["v2"];
  sql2 = "INSERT INTO table(one, two) VALUES('" + v1 + "', '" + v2  + "')";
  
  System.Data.OleDb.OleDbConnection con2 = new System.Data.OleDb.OleDbConnection();
  con2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data          Source=C:/Users/BB/Desktop/Database.mdb";
  con2.Open();
  OleDbCommand command = new OleDbCommand(sql2, con2);
  
  try
  {
      command.ExecuteNonQuery();
  }
  catch
  {
      Response.Write("Error!");
      // detailed error message here?
  }
  </code></pre>