title: Syntax error (missing operator) in query expression, Oledb INSERT Statement
body: <p>I know there's already a bunch of these posts but I looked through a lot of them and they all seem specific to one person's needs, so I figured I'd see if someone could help me for my specific needs.</p>
  
  <p>I am using Oledb and c# and I am trying to create an Excel worksheet and populate it but I'm getting the error "Syntax error (missing operator) in query expression" when using this INSERT statement:</p>
  
  <pre><code>for (int i = 0; i &lt;= 20; i++)
  {
       command.CommandText = string.Format("INSERT INTO [Table] (Id, Tag, Description) VALUES ('{0}','2','3')", diff1[i]);
       command.ExecuteNonQuery();
  }
  </code></pre>
  
  <p>To explain, I have an array of strings, diff1[], and I'm using the loop to insert each element into its own cell, and it works until it gets to the string element:</p>
  
  <pre><code>"\r\n\"603\",\"FuelPumpTestWarning\",\"&lt;table style=\"\"border: 4px solid black; border-collapse:collapse;\"\"&gt;\r\n&lt;tbody&gt;\r\n&lt;tr&gt;\r\n&lt;td bgcolor=\"\"#FF7700\"\" style=\"\"border: 5px solid black; border-collapse:collapse;\"\"&gt;\r\n&lt;div style=\"\"width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 33px solid black; margin: 5px 5px 5px 5px;\"\" &gt;\r\n&lt;p style=\"\"font-family:Arial; color:#ff7700; \r\nfont-size:32px; margin:5px -5px 0px -5px;\"\"&gt;!&lt;/p&gt;\r\n&lt;p style=\"\"color:black; font-size:32px; margin:-45px 30px; font-family:'Arial Black', Arial; font-weight:'900';\"\"&gt;WARNING&lt;/p&gt;\r\n&lt;/div&gt;\r\n&lt;/td&gt;\r\n&lt;/tr&gt;\r\n&lt;tr&gt;\r\n&lt;td style=\"\"border: 5px solid black; border-collapse:collapse;\"\"&gt;\r\n&lt;p style=\"\"font-size:12px; font-family:'Arial Black', Arial; font-weight:'900'\"\"&gt;You are about to perform a test that\r\ninvolves pressurized gasoline being\r\npumped. Before performing this\r\ntest, be sure the area is free and\r\nclear from combustibles, open\r\nflame, welding and/or grinding\r\nsparks, or anything else that could\r\nignite or be an ignition source.&lt;br&gt;\r\n&lt;br&gt;\r\nFAILURE TO FOLLOW THIS WARNING\r\nMAY CAUSE INADVERTENT IGNITION\r\nTHAT COULD RESULT IN SERIOUS\r\nINJURY OR DEATH.&lt;/p&gt;\r\n&lt;/td&gt;\r\n&lt;/tr&gt;\r\n&lt;/tbody&gt;\r\n&lt;/table&gt;\""
  </code></pre>
  
  <p>Ignore the fact that the last two columns are being filled with 2s and 3s, that's just a place holder until I can figure out how to do this because they will also be filled using an array of strings. Is there a special character in the string element that it is getting an error on? It makes it through about 10 other elements which look similar to this one, but gets an error on this one.</p>
  
  <p>I've exhausted every option I can think of so any help would be greatly appreciated.</p>