日期:2014-05-17  浏览次数:21472 次

..aspx”不包含“Button1_Click1”的定义..一个参数的扩展方法“Button1_Click1”(是否缺少 using 指令或程序集引用?)
编译器错误消息: CS1061: “ASP.yemian_reg_aspx”不包含“Button1_Click1”的定义,并且找不到可接受类型为“ASP.yemian_reg_aspx”的第一个参数的扩展方法“Button1_Click1”(是否缺少 using 指令或程序集引用?)

源错误:

 

行 58:            
行 59:                <div align="center">
行 60:                  <asp:Button ID="Button1" runat="server" Text="确认" onclick="Button1_Click1"  />
行 61: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
行 62:                    <asp:Button ID="Button2" runat="server" Text="取消" />
 

源文件: d:\练习做的项目\Test\Test\yemian\reg.aspx    行: 60 


cs文件代码
  protected void Button1_Click1(object sender, EventArgs e)
        {
        string user1 = this.user1.Text;
            string pass1 = this.pass1.Text;
            string pass2 = this.pass2.Text;
            string email = this.email.Text;
            try{
            string conString = System.Configuration.ConfigurationManager.ConnectionStrings["constring"].ToString();
            SqlConnection sqlcon = new SqlConnection(conString);
            sqlcon.Open();


            SqlCommand cmd = new SqlCommand("insert into user_info (user_name,user_pass,user_email) values('"+ user1+"','"+pass2+"','"+email+"')", sqlcon);
            //SqlCommand sqlcom=new SqlCommand();
            
             int i=(int)cmd.ExecuteNonQuery();

            //int i = (int)cmd.executeNonQuery();
            if(i>0){

                sqlcon.Close();
                Response.Redirect("loginsuccess.aspx");}}
             catch (Exception ex)
                {

                    throw ex;
                }
   &