首页 > 解决方案 > Asp.net 插入语句中的多个替换字符?

问题描述

我在我的 asp.net 网页中有一个 SQL 插入语句,如果“:”存在而没有任何内容“”,我必须替换测试框内容,如下所示

TextBox.Text.Replace(":", "")

有没有办法可以添加一个额外的字符来替换?如果输入到文本框中,我还需要删除“#”。

标签: sqlasp.netvb.net

解决方案


我不知道这些是否可行,但值得一试:

TextBox.Text.Replace(":", "").Replace("#", "")

或者

String mytext = TextBox.Text;
mytext.Replace(":", "");
mytext.Replace("#", "");
TextBox.Text = mytext;

推荐阅读