Q:

problem in update query!

I had written a query like this
  string strUpdateQuery = "UPDATE M_QA SET ANSWER = '" + txtEditorAnswer.Text.Trim().Replace("'", "''")
                                      + "', UPDATED_ON = getDate(), UPDATED_BY = '" + this.Session["UserId"].ToString()
                                      + "' WHERE PK_ID = " + _currentQuestionId + " AND IS_ACTIVE = 1";

but the value doesn't get updated untill i put a breakpoint at this query.
Can anyone please help me..

A:

You should be using a library to assemble your SQL statements rather than direct concatenation. 
What does SQL Profiler show as the query being passed to the server? 
If I had to wager a guess, I would say that either the question with the given primary key does not exist at the time the query is executed or the question is not yet active at the time the query is executed. Either way, you need to verify the exact query that is actually being passed to the server (via SQL Trace/Profiler) and you need to verify that the primary key value actually exists at the time the query is executed and that the question is actually marked as active.

