写了两个方法都不太对.希望各位给予解决,谢谢!!!!!(不用验证控件)
代码如下:
1. public static bool isNull(string un, string pwd)
{
if((un=="")||(pwd==""))
{
return false;
}
else
{
return true;
}
}2. public static bool isnotNull(string un, string pwd)
{
if((un!="")&&(pwd!=""))
{
return true;
}
else
{
return false;
}
}
代码如下:
1. public static bool isNull(string un, string pwd)
{
if((un=="")||(pwd==""))
{
return false;
}
else
{
return true;
}
}2. public static bool isnotNull(string un, string pwd)
{
if((un!="")&&(pwd!=""))
{
return true;
}
else
{
return false;
}
}
解决方案 »
- MVC中的样式问题,欢迎大家来讨论(结贴率100%)
- 关于日期时间的正则表达式的问题,有请各位高人指点!急!!
- 如何通过点击按钮自动打开一个超级链接
- 问大家一个FileUpload的菜问题。
- Crystal Report 字段显示问题
- 如何在每月1号让数据库中TYPE为1的数值自动减少5000,求教(如果用户上万,如何优化存储过程,同时如果用户数值自动减少5000小于,如何自动发
- 关于特殊字符的问题
- Infragistics的WebGrid怎么用客户端程序加行?
- 新手请教:求一SQL语句的写法。请帮我看看
- <% @Assembly Name="System.Net" %>调用以后就出错:找不到文件或程序集名称“System.Net”,或找不到它的一个依赖项
- 关于Response.Cache.SetNoStore()
- 求助一个很久没解决的问题!动态列GridView并且有增、删、改
public static bool isnotNull(string un,string pwd)
if((un.Length == 0) || (pwd.Length == 0))
{
return true;
}
else
{
return false;
}
}
{
if((un.Length != 0) && (pwd.Length != 0))
{
return true;
}
else
{
return false;
}
}
{
if ((un.Length != 0) &&(pwd.Length != 0))
{
return true; ;
}
else
{
return false;
}Default.aspx: protected void txtUserName_Click(object sender, EventArgs e)
{
string un = this.txtUserName.Text.Trim();
string pwd = this.txtPassword.Text.Trim();
if (DB.isNull(un,pwd))
{ Response.Write("验证用户名和密码都不为空");
}
else
{
Response.Write("验证用户名或密码至少有一项为空");
}