Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Column count doesn't match value count at row 1
  2.  
  3. for (int x = 2; x < rowCount; x++)
  4. {
  5.  
  6. string str = xlRange.Cells[x, 2].Text;
  7.  
  8. string query = "INSERT INTO feture (F1) VALUES (" + str + ")";
  9. MessageBox.Show(x.ToString());
  10. MySqlCommand cmd = new MySqlCommand(query, conect);
  11. cmd.ExecuteScalar();
  12.  
  13. }
  14.  
  15. string query = "INSERT INTO feture (F1) VALUES (" + str + ")";
  16.  
  17. string query = "INSERT INTO feture (F1) VALUES ( '" + str + "' )";
  18.  
  19. string query = "INSERT INTO feture (F1) VALUES (@value)";
  20. MySqlCommand cmd = new MySqlCommand(query, conect);
  21. cmd.Parameters.AddWithValue("@value", str);
  22. cmd.ExecuteScalar();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement