开发者

problem when insert "\\" in MySQL table

开发者 https://www.devze.com 2023-01-12 19:52 出处:网络
when i insert a specific value in MySQL table through code i get exception (1064 error) i know the reason , but i don\'t know how to fix the problem,, all what i wanna to do is to store the relative

when i insert a specific value in MySQL table through code i get exception (1064 error)

i know the reason , but i don't know how to fix the problem,, all what i wanna to do is to store the relative path of my images in the image table then i get this exception all the time when the in开发者_运维技巧serted string contains "\" or @"\".

how can i fix this problem


Chances are you're embedding the values directly into your SQL. Don't do that: use a parameterized query instead, which will keep your SQL code separate from the data. This means you don't need to worry about formatting values or SQL injection attacks, and lets you reuse statements.

0

精彩评论

暂无评论...
验证码 换一张
取 消