如何在多行文本框中除撇号和未封闭引号外 [英] How do I except apostrophe and unclosed quotes in multiple line textbox

查看:71
本文介绍了如何在多行文本框中除撇号和未封闭引号外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Comments_Text = txtComments.Text;

推荐答案

我不知道您的意思是什么.您的意思是将文本传递到数据库中,而您在构建SQL时遇到了麻烦?如果您构建参数化查询而不是字符串混搭,那么它会自行处理.

当您离开我试图猜测您想要的内容时,如果不是,请编辑您的帖子以使您的问题更清楚.
I have no idea what you mean by except. Do you mean passing the text into your database, and you have trouble building the SQL ? If you build a parameterised query instead of string mashing, that takes care of itself.

As you left me trying to guess what you want, if that''s not it, edit your post to make your question clearer.


如果您要接受"撇号和不加引号的引号...然后textarea会自动执行该操作...并且正如已经建议将CG插入SQL一样,请使用参数化查询.

如果您要的是不接受"的撇号和不加引号的引号,那么您可以编写 Javascript 函数,在离开文本框时对此进行检查(onchange, onblurr, onfocusout 事件-选择任意一).将您的逻辑检查所有需要验证的内容.您也可以在javascript中使用Regex进行验证.
If you are asking for ''accepting'' apostrophe and unclosed quotes... then textarea does that automatically... and as CG already suggested for inserting into SQL use parametrized query.

If you are asking for ''not-accepting'' apostrophe and unclosed quotes... then you can write a Javascript function that checks this for you on leaving the textbox (onchange, onblurr, onfocusout events - pick any one). Put your logic to check what all you need to verify. You can also use Regex in javascript for verification.


这篇关于如何在多行文本框中除撇号和未封闭引号外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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