使用C#在mysql中添加反斜杠 [英] add backslash in mysql using c#
本文介绍了使用C#在mysql中添加反斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道什么是php的C#等价物.
mysql_real_escape_string函数.如果没有等效项
功能,C#中的哪些功能将帮助我获得相同的结果
作为php mysql_real_escape_string函数.
Hi, I would like to know what is the C# equivalent to php
mysql_real_escape_string function. If there are no equivalent
funcitons, what functions in C# will help me attain the same results
as php mysql_real_escape_string function.
推荐答案
我不知道php做什么,但是C#使用参数化查询来确保您的字符串格式正确.您永远都不要在C#中使用字符串混搭来构建SQL.
I have no idea what php does, but C# uses parameterised queries to make sure that your strings are properly formed. You should never build SQL with string mashing in C#.
我不知道这是否在您要找的东西,但添加到反斜杠只会添加一个.
例如string strTemp = "\\";
I dont know if this is what you were looking for but adding to backslashes adds a single one.
For e.g.string strTemp = "\\";
这篇关于使用C#在mysql中添加反斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文