title: Use OleDbDataAdapter to insert into an Access db
body: <p>I would like to insert some data into an Access Database.</p>
  
  <pre><code>DataTable dt = new DataTable();
  String sql = string.Format("SELECT * FROM {0} where 1=0; ", tmap.SqlTableName);
  string con = string.Format(conn, accessPath);
  OleDbDataAdapter da = new OleDbDataAdapter(sql, con);
  OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(da);
  da.InsertCommand = cmdBuilder.GetInsertCommand(true); // Returns "INSERT INTO test (int, bdate, amt, text, bit) VALUES (?, ?, ?, ?, ?)"
  da.Fill(dt);
  //Add data to the DateTable
  for (int i = 0; i &lt; rowCount; i++)
  {
  DataRow dr = dt.NewRow();
  //....
  dt.Rows.Add(dr);
  }
  da.Update(dt); //This is where things go south.
  </code></pre>
  
  <p>System.Data.OleDb.OleDbException<br>
  Message:   Syntax error in INSERT INTO statement.<br>
  Source:   Microsoft JET Database Engine.</p>
  
  <p>If I change the insert command:  </p>
  
  <pre><code>da.InsertCommand = new OleDbCommand("INSERT INTO test ([text]) VALUES (?)");  
  </code></pre>
  
  <p>and change the incoming data to only have a single text value I get:</p>
  
  <p>No value given for one or more required parameters.</p>
  
  <p>Am I missing something?</p>