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

前端 未结 6 584
说谎
说谎 2021-01-24 00:11

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:

6条回答
  •  失恋的感觉
    2021-01-24 00:30

    This is a syntax error from SQL, obviously, not from C#.

    You need to get the values you're inserting at runtime -- then you'll see the syntax error in the SQL statement.

    EDIT Or you could just do what @zincorp says :)

    As a general practice, it's more readable to use String.Format in this type of situation. Even more importantly, you also want to be sure you escape your literals.

提交回复
热议问题