0

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..

2
  • You will have to show a bit more code than that... Commented Oct 13, 2010 at 4:47
  • as it stands, question makes no sense... Commented Oct 13, 2010 at 4:47

1 Answer 1

1
  1. You should be using a library to assemble your SQL statements rather than direct concatenation.
  2. What does SQL Profiler show as the query being passed to the server?
  3. 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.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.