如何解决编译器错误消息:CS1061 ASPX?

时间:2019-04-08 19:11:12

标签: c# visual-studio

我的Web表单中有两个按钮;第一个有效,但是当我添加第二个时,我开始出现此错误:

错误

  

编译器错误消息:CS1061:'signin_aspx'不包含'pbtn_Click'的定义,并且找不到扩展方法'pbtn_Click'接受类型为'signin_aspx'的第一个参数(您是否缺少using指令或程序集参考?

代码

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

    }

    protected void pfe_Click(object sender, EventArgs e)
    {
        string nname = this.pfun.Text;
        string npass = this.pfpw.Text;
        Session["UserName"] = pfun;
        string sqlstr2 = "select * from hsinfo WHERE rname='" + nname + "' AND rpass='" + npass + "'";
        DataTable dt1 = DBFunction.SelectFromTable(sqlstr2, "DBS.accdb");
        if (dt1.Rows.Count > 0)
            Response.Redirect("~/homepage.aspx");
        else
            this.lblinfo.Text = "account not found";

    }

    protected void pbtn_Click(object sender, EventArgs e)
    {
        string postname = this.uop.Text;
        string postpass = this.pou.Text;
        string sqlstr2 = "select * from professors WHERE pname='" + postname + "' AND ppass='" + postpass + "'";
        DataTable dt1 = DBFunction.SelectFromTable(sqlstr2, "DBS.accdb");
        if (dt1.Rows.Count > 0)
        {
            Response.Redirect("~/HPprofessors.aspx");
        }
        else
            this.lblinfo2.Text = "Entering from here is only allowed for profesors and it seems that you're not one";
    }

0 个答案:

没有答案
相关问题