title: Incorrect syntax near 's'. Unclosed quotation mark after the character string ')'
body: <p>I know I should use paramaterized queries for this but it is an internal tool for inserting text files. Anyone see the error for the Unclosed quote? Weird, I ran it in SQL Server 2014 and it ran successfullyafter I dropped " and the ; at the end of the Values assign. But in Visual studio in my project it needs the ";
   Here is my code:</p>
  
  <pre><code>    for (int i = 0; i &lt; ds.Tables[0].Rows.Count; i++)
              {
                  string conn = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                  SqlConnection con = new SqlConnection(conn);
                  string query = "Insert into BluStar(ProductID,Manufacturer,SKU,BlueStarSKU,MSRP,RoughSummary,COST,Inventory,Weight,CAT4th,CAT1st,CAT2nd,CAT3rd,ProductName,Genre,ProductName2,RougherSummary,Cat_4th,Field1,Field2,Field3,Field4,Field5,Field6,Field7,Field8,Field9,Field10,Field11,Field12,Field13) Values('" + ds.Tables[0].Rows[i][0].ToString() + "','" + ds.Tables[0].Rows[i][1].ToString() + "','" + ds.Tables[0].Rows[i][2].ToString() + "','" + ds.Tables[0].Rows[i][3].ToString() + "','" + ds.Tables[0].Rows[i][4].ToString() + "','" + ds.Tables[0].Rows[i][5].ToString() + "','" + ds.Tables[0].Rows[i][6].ToString() + "','" + ds.Tables[0].Rows[i][7].ToString() + "','" + ds.Tables[0].Rows[i][8].ToString() + "','" + ds.Tables[0].Rows[i][9].ToString() + "','" + ds.Tables[0].Rows[i][10].ToString() + "','" + ds.Tables[0].Rows[i][11].ToString() + "','" + ds.Tables[0].Rows[i][12].ToString() + "','" + ds.Tables[0].Rows[i][13].ToString() + "','" + ds.Tables[0].Rows[i][14].ToString() + "','" + ds.Tables[0].Rows[i][15].ToString() +
                  "','" + ds.Tables[0].Rows[i][16].ToString() + "','" + ds.Tables[0].Rows[i][17].ToString() + "','" + ds.Tables[0].Rows[i][18].ToString() + "','" + ds.Tables[0].Rows[i][19].ToString() + "','" + ds.Tables[0].Rows[i][20].ToString() + "','" + ds.Tables[0].Rows[i][21].ToString() + "','" + ds.Tables[0].Rows[i][22].ToString() + "','" + ds.Tables[0].Rows[i][23].ToString() + "','" + ds.Tables[0].Rows[i][24].ToString() + "','" + ds.Tables[0].Rows[i][25].ToString() + "','" + ds.Tables[0].Rows[i][26].ToString() + "','" + ds.Tables[0].Rows[i][27].ToString() + "','" + ds.Tables[0].Rows[i][28].ToString() + "','" + ds.Tables[0].Rows[i][29].ToString() + "','" + ds.Tables[0].Rows[i][30].ToString() + "')";
                  con.Open();
                  SqlCommand cmd = new SqlCommand(query, con);
                  cmd.ExecuteNonQuery();
                  con.Close();
              }
  </code></pre>
  
  <p>Here is the code I have to convert from console to MVC to read the csv file.</p>
  
  <pre><code>    &lt;%@ Page Language="C#" %&gt;
  &lt;html&gt;
  &lt;head&gt;
     &lt;title&gt;read file insert into data base&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;%@Import namespace=System.Data %&gt;
  &lt;%@Import namespace=System.Data.SqlClient %&gt;
  &lt;% 
  
  System.IO.StreamReader sr = new System.IO.StreamReader("/testdata/test.csv");
  string line;
  while(sr.Peek() != -1)
  {
     line = sr.ReadLine();
     String[] parts = line.Split('\t');
     Response.Write(Server.HtmlEncode(parts[3]) + "&lt;br/&gt;");
  
  string conn = "";
  string Manu;
  string sku;
  Decimal msrp = Convert.ToDecimal(parts[4]);  
  conn = ConfigurationManager.ConnectionStrings["Conn"].ToString(); 
  SqlConnection objsqlconn = new SqlConnection(conn); 
  objsqlconn.Open(); 
  SqlCommand objcmd = new SqlCommand("Insert into ScanSource(Manufacture,SKU,MSRP) Values(@Manu, @sku,@msrp)", objsqlconn);
  objcmd.Parameters.AddWithValue("@Manu",parts[1]);
  objcmd.Parameters.AddWithValue("@sku",parts[3]);
  objcmd.Parameters.AddWithValue("@msrp",msrp);
  objcmd.ExecuteNonQuery(); 
  }
  %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>