How do I convert a string into safe SQL String?

前端 未结 2 812

I\'m generating some sql insert statements from a bunch of text files.

These text files are generally user input data. I would like to sanitize this data so that it\

2条回答
  •  春和景丽
    2020-12-05 14:10

    There is only a single character you have to escape: ansi 0x27, aka the single quote:

    safeString = unsafeString.Replace("'","''");
    

提交回复
热议问题