Incorrect syntax near ''. Unclosed quotation mark after the character string ' '.

Posted by Mattec on Stack Overflow See other posts from Stack Overflow or by Mattec
Published on 2010-04-21T19:11:48Z Indexed on 2010/04/21 19:13 UTC
Read the original article Hit count: 452

Filed under:
|

I'm just wondering if someone could point me in the right direction here, I think i've been looking at it for too long so can't see the mistake.

The following code:

            SqlCommand updateStyle = new SqlCommand("UPDATE [Lorenz].[dbo].[Layout] SET [bgColour] = '" + bgColour + "' , [textColour] = '" + txtColour + "WHERE <[LoweredUserName] ='" + currentUser + "' ", connection);
            updateStyle.ExecuteNonQuery();

Is giving the error:

Incorrect syntax near 'admin'. Unclosed quotation mark after the character string ' '.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET