注册 登录
编程论坛 ASP.NET技术论坛

运算符“&&”无法应用于“string”和“System.Web.UI.WebControls.TextBox”类型的操作数

昊子园园 发布于 2008-12-15 21:24, 1475 次点击
CS0019: 运算符“&&”无法应用于“string”和“System.Web.UI.WebControls.TextBox”类型的操作数

源错误:

 

行 18:     protected void Btndl_Click(object sender, EventArgs e)
行 19:     {
行 20:         if (this.Textusername="a"&&this.Textuserpwd="a")
行 21:         {
行 22:             Response.Redirect("main.aspx");
3 回复
#2
昊子园园2008-12-15 21:24
运算符“&&”无法应用于“string”和“System.Web.UI.WebControls.TextBox”类型的操作数
CS0019: 运算符“&&”无法应用于“string”和“System.Web.UI.WebControls.TextBox”类型的操作数

源错误:



行 18:     protected void Btndl_Click(object sender, EventArgs e)
行 19:     {
行 20:         if (this.Textusername=="a"&&this.Textuserpwd=="a")
行 21:         {
行 22:             Response.Redirect("main.aspx");
#3
bygg2008-12-16 09:26
if (this.Textusername.Text=="a"&&this.Textuserpwd.Text=="a")
1