剥离数据库存储的报价 [英] Stripping Out Quotes For Database Storage

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

问题描述

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

错误,我必须在保存到

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

而不是URLEncode的工作方式吗?


TIA,


Col

解决方案

通常你只需加倍它们就可以将它们保存在数据库中......


如果您使用参数进行查询,您甚至不需要将它们加倍。


Patrice


-


" Colin Steadman" <共************ @ gmail.com>一个écritdansle message de

news:52 ************************** @ posting.google.c om ...

我的ASP页面允许用户在表单中输入注释。为了避免错误,我必须在保存到
数据库之前删除双引号。是否有编码这些以便我可以存储它们
而不是URLEncode的工作方式?

TIA,

Col



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

错误,我必须在保存到
数据库之前删除双引号。


双引号会出现什么错误?除非你有一些奇怪的语法,否则不应该发生这种情况。你能否展示一个失败的例子,并且你得到的错误信息是什么?


在ASP中构建动态SQL语句时唯一的问题角色

应该是''字符。
http://www.aspfaq .com / 2035


-
http://www.aspfaq.com/

(反向地址回复。)



有吗无论如何编码这些以便我可以存储它们,就像URLEncode的工作方式一样?

TIA,

Col



Aaron [SQL Server MVP]写道:

我的ASP页面允许用户在表单中输入注释。为了避免错误,我必须在保存到
数据库之前删除双引号。



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

在ASP中构建动态SQL语句时唯一的问题是
应该是''字符。 br /> http://www.aspfaq.com/2035




别忘了,如果他正在使用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

解决方案

Usually you just have to double them to keep them in the db...

If you use parameters for your queries, you'' don''t even have to double them.

Patrice

--

"Colin Steadman" <co************@gmail.com> a écrit dans le message de
news:52**************************@posting.google.c om...

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



> 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.
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

--
http://www.aspfaq.com/
(Reverse address to reply.)


Is there anyway to encode these so that I can store them instead, in the way was an URLEncode works?

TIA,

Col



Aaron [SQL Server MVP] wrote:

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.



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.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆