title: record not inserting into access database
body: <p>I have a C# windows application and I’m trying to insert data (which has been entered by the user) into an access database.  I am not getting any errors, however it is not entering the data.  Any thought?</p>
  
  <pre><code>        string sqlInsert = "insert into assessment (id) values (@id)";
  
          using (OleDbConnection conn = new OleDbConnection(dsn))
          {
  
              OleDbCommand cmd = new OleDbCommand(sqlInsert, conn);
  
              cmd.Parameters.Add("@id", OleDbType.VarChar, 50).Value = iDTextBox.Text.Trim().Length != null ? storedID.Trim() : "";
  
              conn.Open();
              cmd.ExecuteNonQuery();
              conn.Close();
          }
  </code></pre>
  
  <p>The datatype for id is <code>Text</code>.</p>
  
  <p>Edit:
  connection string is stored in app.config as:</p>
  
  <pre><code>&lt;add name="conn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\CADSCUPP.mdb" providerName="System.Data.OleDb"/&gt;
  </code></pre>
  
  <p>and accessed in the code by:</p>
  
  <pre><code>private string dsn = System.Configuration.ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
  </code></pre>
  
  <p>If I insert records manually (not through the code behind code) I can read the records elsewhere in the program so that connection works.</p>