如果声明不起作用? [英] If statement does not work?

查看:96
本文介绍了如果声明不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它总是与else一起使用,即使txtUserName.Text =Adm_A为什么会这样?



it always go with else, even if txtUserName.Text = "Adm_A" Why is that ?

If txtUserName.Text Like "Adm_?" Then
            Response.Redirect("AdminLoggedIn.aspx")
        Else
            Response.Redirect("LoggedIn.aspx")
        End If

推荐答案





请尝试修剪文本并进行测试。



祝你好运。



问候,

Vamsi
Hi,

Please try to trim the Text and test it out.

Good luck.

Regards,
Vamsi


试试吧

Try it
If txtUserName.Text.Trim() Like "Adm_?" Then
            Response.Redirect("AdminLoggedIn.aspx")
        Else
            Response.Redirect("LoggedIn.aspx")
        End If


使用类似代码 -

use code like--
if(txtUserName.Text.Contains("Adm_?"))
{
  Response.Redirect("AdminLoggedIn.aspx")
}
else
{
  Response.Redirect("LoggedIn.aspx")
}


这篇关于如果声明不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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