我需要帮助的c#编码问题 [英] c# coding problem that i need help with

查看:81
本文介绍了我需要帮助的c#编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误3''Button2_Click''不是''ASP.newmember_aspx''的成员。 C:\ Users \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\类中的方法,即代码:



Error 3 ''Button2_Click'' is not a member of ''ASP.newmember_aspx''. C:\Users\dr.apple\Documents\Visual Studio 2010\WebSites\WebSite2\newmember.aspx 45

although i have the method in inside the class and that is the code:

protected void Button2_Click(object sender, EventArgs e) 
{ SqlConnection con = new SqlConnection(Database.ConnectionString);
 try {
 con.Open(); SqlCommand cmd = new SqlCommand("select isnull(max(mid),0)+1 from members", con);
 int mid = (int)cmd.ExecuteScalar();
 SqlCommand cmd1 = new SqlCommand("select isnotnull from members", con); 
string mname = (string)cmd1.ExecuteScalar();
 SqlCommand cmd3 = new SqlCommand("select isnotnull from members", con);
 Char password = (char)cmd3.ExecuteScalar();
 SqlCommand cmd4 = new SqlCommand("select isnotnull from members", con);
 string email = (string)cmd4.ExecuteScalar();
 cmd.CommandText = "insert into members values(@mid,@name,@password,@email)"; cmd.Parameters.Add("@mid", SqlDbType.Int).Value = mid; cmd.Parameters.Add("@mname", SqlDbType.VarChar, 50).Value = mname; cmd.Parameters.Add("@password", SqlDbType.VarChar, 10).Value = password; cmd.Parameters.Add("@email", SqlDbType.VarChar, 40).Value = email; cmd.ExecuteNonQuery(); HttpContext.Current.Trace.Write("Member has been added successfully with ID = " + mid); } catch (Exception ex) { HttpContext.Current.Trace.Write("error" + ex.Message); } finally { con.Close(); } } }

推荐答案

我相信你的问题是设计师没有添加Button2_Click。

尝试复制上面的代码,删除它,然后再次添加方法并粘贴代码。我不太了解ASP.NET,但祝你好运。
I believe your problem is that the designer doesn''t have Button2_Click added.
Try copying your code above, deleting it, then add the method again and paste the code. I don''t know much about ASP.NET, but best of luck.


roblem是设计师没有添加Button2_Click。

试试复制上面的代码,删除
roblem is that the designer doesn''t have Button2_Click added.
Try copying your code above, deleting


这篇关于我需要帮助的c#编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆