Guest User

Untitled

a guest
Aug 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. sql error - missing a (;) at the end of sql statement
  2. INSERT INTO photoDB(fileNames)
  3. VALUES('" + Path.GetFileName(fileName) + "')
  4. ON DUPLICATE KEY UPDATE fileNames = 1
  5.  
  6. SqlConnection conn = new SqlConnection("ConnectionString");
  7.  
  8. SqlCommand command = new SqlCommand();
  9. command.Connection = conn;
  10. command.CommandText = "INSERT INTO photoDB (fileNames) VALUES(@fileName) ON DUPLICATE KEY UPDATE fileNames = 1;";
  11. command.Parameters.Add(new SqlParameter("@filename", System.Data.SqlDbType.VarChar).Value = Path.GetFileName(fileName));
  12. command.ExecuteNonQuery();
Add Comment
Please, Sign In to add comment