双引号被替换为 ' +字符(34) + '使用 ASP.NET 在 SQL 中

发布于 2024-09-15 18:18:35 字数 175 浏览 3 评论 0原文

我正在使用 SQL Server 2008 Web Edition,似乎我的 SQL 查询自动将双引号替换为 ' + CHAR(34) + '。我试图确定为什么会发生这种情况,我将 Delphi 与 ASP.NET 结合使用,并使用 ADO.NET 对象来执行 SQL。

以前有人遇到过这个吗?

I am using SQL Server 2008 Web Edition and it seems my SQL queries are automagically having the double quotes replaced with ' + CHAR(34) + '. I am trying to pin down why this is happening, I am using Delphi with ASP.NET and using the ADO.NET object for the SQL.

Has anyone come across this before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海拔太高太耀眼 2024-09-22 18:18:36

事实证明,问题不是 ASP.NET 或 Delphi 造成的,而是我用来允许用户输入数据的编辑器造成的。在将内容吐给我之前,它会替换所有双引号。

It turns out that it isn't ASP.NET or Delphi causing the issue but is the editor I am using to allow the user to input data. It is replacing all the double quotes before spitting the content out to me.

冰火雁神 2024-09-22 18:18:36

您可以尝试转义它们: Result = System.Text.RegularExpressions.Regex.Replace(InputTxt, @"[\000\010\011\012\015\032\042\047\134\140]", " \\$0");

编辑:抱歉,没有意识到您正在使用delphi。我确信即使代码不适用,该理论仍然适用。

You could try escape them: Result = System.Text.RegularExpressions.Regex.Replace(InputTxt, @"[\000\010\011\012\015\032\042\047\134\140]", "\\$0");

EDIT: sorry, didn't realize you were using delphi. I'm sure the theory still applies even if the code doesn't.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文