本文介绍了剥离数据库存储的报价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ASP页面允许用户在表单中输入注释。为了避免

错误,我必须在保存到

数据库之前删除双引号。无论如何编码这些以便我可以存储它们

而不是URLEncode的工作方式吗?


TIA,


Col

解决方案







你用双引号会得到什么错误?这不应该发生,除非你有一些奇怪的语法。你能否展示一个失败的例子,以及你得到的错误信息?

在ASP中构建动态SQL语句时唯一的问题是
应该是''字符。 br />




别忘了,如果他正在使用Access,Access允许你使用对于数据

分隔符而不是''。如果这就是他正在做的事情,那么就是嵌入式的将

引起这个问题,当然,它有相同的解决方案:

1.使用参数代替动态sql

2.逃生将它加倍


Bob Barrows

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


My ASP page allows user to enter comments into a form. To avoid
errors I''m having to strip out double quotes before saving to the
database. Is there anyway to encode these so that I can store them
instead, in the way was an URLEncode works?

TIA,

Col

解决方案







What errors do you get with double quotes? This shouldn''t happen
unless you have some weird syntax going on. Can you show an example
that fails, and the error message you get?

The only problem character when building dynamic SQL statements in ASP
should be the '' character.
http://www.aspfaq.com/2035



Don''t forget, if he''s using Access, Access allows you to use " for the data
delimiter instead of ''. If that''s what he''s doing, then an embedded " will
cause this problem, which, of course, has the same solutions:
1. Use parameters instead of dynamic sql
2. Escape the " by doubling it

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


这篇关于剥离数据库存储的报价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 07:36
查看更多