Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am running the following update command:

NpgsqlCommand command = new NpgsqlCommand("UPDATE \"FPConfig_simulationresult\" SET key_name = :keyName WHERE id = :resultID", conn);

  command.Parameters.Add(new NpgsqlParameter("keyName", DbType.String));
  command.Parameters.Add(new NpgsqlParameter("resultID", DbType.Int32));
  command.Parameters[0].Value = keyName;
  command.Parameters[1].Value = resultID;
  int rowsAffected = command.ExecuteNonQuery();

and get the error:

ERROR: 42601: syntax error at or near "="

I have checked everything in the update SQL statement, the table name and field names are correct.

share|improve this question
    
Could you show us the entire piece of SQL? Check the logfiles from the database server. –  Frank Heikens Jan 14 at 15:21
    
Also, can you add your postgresql and NPGSQL versions... –  mlinth Jan 14 at 15:33
    
You can also check the ErrorSql property of the NpgsqlException which will show you the sql which gave the error. I hope it helps. –  Francisco Junior Jan 14 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.