嗨.. ..获取errorin server.excute方法........ [英] hi ..iam getting errorin server.excute method........
本文介绍了嗨.. ..获取errorin server.excute方法........的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
错误
protected void Page_Load( object sender,EventArgs e)
{
if ( string .IsNullOrEmpty(TextBox1.Text)) string .IsNullOrEmpty(TextBox2.Text)
{
Label1.Text = 空无效;
Label1.ForeColor.System.Drawing.Color.Red;
}
其他
{
int c = 0 ;
for (inti = 0 ; i< Info.GetLength( 0 ); i ++)
{
if (Info [i, 0 ]。ToString()== TextBox1.Text&& Info [i, 1 ]。ToString()== TextBox2.Text)
{
c = 1 ;
break ;
}
}
如果(c == 1 )
{
Response.Redirect( Success.aspx);
}
else
{
Response.Redirect( Failed.aspx);
}
解决方案
更改代码如
if(string.IsNullOrEmpty(TextBox1.Text)&& string.IsNullOrEmpty(TextBox2.Text))
{
Label1.Text =Nulls Not Valid;
Label1.ForeColor = System.Drawing.Color.Red;
}
其他
{
int c = 0;
for(int i = 0; i< info.getlength(0); i ++)
{
if((Info [i,0] .ToString()== TextBox1.Text) &&(Info [i,1] .ToString()== TextBox2.Text))
{
c = 1;
休息;
}
}
if(c == 1)
{
Response.Redirect(Success.aspx);
}
else
{
Response.Redirect(Failed.aspx);
}
}
修复此行
if ( string .IsNullOrEmpty(TextBox1.Text)) string .IsNullOrEmpty(TextBox2.Text)
to
if ( string .IsNullOrEmpty(TextBox1.Text)|| string .IsNullOrEmpty(TextBox2。文本))
hi
error
protected void Page_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(TextBox1.Text))string.IsNullOrEmpty(TextBox2.Text)
{
Label1.Text="Nulls Not Valid";
Label1.ForeColor.System.Drawing.Color.Red;
}
else
{
int c=0;
for(inti=0;i<Info.GetLength(0);i++)
{
if(Info[i,0].ToString()==TextBox1.Text&&Info[i,1].ToString()==TextBox2.Text)
{
c=1;
break;
}
}
if(c==1)
{
Response.Redirect("Success.aspx");
}
else
{
Response.Redirect("Failed.aspx");
}
解决方案
Change the Code like
if (string.IsNullOrEmpty(TextBox1.Text) && string.IsNullOrEmpty(TextBox2.Text)) { Label1.Text="Nulls Not Valid"; Label1.ForeColor = System.Drawing.Color.Red; } else { int c=0; for(int i=0;i<info.getlength(0);i++) { if((Info[i,0].ToString()==TextBox1.Text)&&(Info[i,1].ToString()==TextBox2.Text)) { c=1; break; } } if(c==1) { Response.Redirect("Success.aspx"); } else { Response.Redirect("Failed.aspx"); } }
Fix this line
if (string.IsNullOrEmpty(TextBox1.Text))string.IsNullOrEmpty(TextBox2.Text)
to
if (string.IsNullOrEmpty(TextBox1.Text) || string.IsNullOrEmpty(TextBox2.Text))
这篇关于嗨.. ..获取errorin server.excute方法........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文