Login Visual Studio找不到文本框

Login Visual Studio找不到文本框,login,error-handling,textbox,Login,Error Handling,Textbox,在我的高年级项目中创建了一个调度系统,老师无法找出为什么它也找不到。 EmployeeIDTxtBox和PasswordTxtBox都是文本框,但找不到 谢谢你的帮助 有人能找到错误吗 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.

在我的高年级项目中创建了一个调度系统,老师无法找出为什么它也找不到。 EmployeeIDTxtBox和PasswordTxtBox都是文本框,但找不到

谢谢你的帮助

有人能找到错误吗

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class LogIn : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void SubmitBtn_Click(object sender, EventArgs e)
    {

        SqlConnection con = new SqlConnection("Data Source=MISSQL;Initial Catalog=NUSSOFTDB;Integrated Security=True");
        con.Open();
        SqlCommand cmd = new SqlCommand("Select * FROM EmployeeT WHERE EmployeeID='" + Convert.ToInt16(EmployeeIDTxtBox.Text) + "' and Password ='" + PasswordTxtBox.Text + "'", con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            Response.Redirect("Schedule1.aspx");
        }
        else
        {
            Response.Write("<script>alert('Please enter valid Username and Password')</script>");
        }
    }
}

我没有看到EmployeeIDTxtBox或PasswordTxtBox在任何地方定义。还有一些代码没有发布吗?我猜这是一个范围问题,可能是@Will所指的。注意,您使用的是类LogIn:System.Web.UI.Page中的文本框,它们是否在同一范围内声明和实例化?对不起,伙计们,是的,它在设计页面中。我发现我在从EmployeeT表调用employeeID时,它实际上被重新标记为EmailAddress。一切都很好,谢谢你的回复!