按钮OnClick事件在编译时显示错误

时间:2016-06-04 12:54:26

标签: asp.net vb.net

错误:方法'受保护的事件登录为System.Web.UI.WebControls.Button'没有与委托'Delegate Sub EventHandler(sender As Object,e As System.EventArgs)'兼容的签名。

<asp:Button ID="btnLogin" runat="server" Text="Login with FaceBook" OnClick="Login" />

Protected Sub Login(sender As Object, e As EventArgs)
        FaceBookConnect.Authorize("user_photos,email", Request.Url.AbsoluteUri.Split("?"c)(0))
        Try
            Dim str1 As String = "INSERT INTO users (ID, DP, displayName) values('" + lblId.Text + "', '" + ProfileImage.ImageUrl.ToString + "', '" + lblName.Text + "')"
            Dim str2 As MySqlDataReader
            Dim adapter As New MySqlDataAdapter
            Dim command As New MySqlCommand
            command.CommandText = str1
            command.Connection = con
            adapter.SelectCommand = command
            con.Open()
            str2 = command.ExecuteReader
            con.Close()
        Catch ex As Exception
            Response.Write(ex)
        End Try
    End Sub

1 个答案:

答案 0 :(得分:0)

根本不应该是豆子问题。我猜你可能已经定义了一个名为EventArgs的类。将签名更改为

Protected Sub Login(sender As Object, e As System.EventArgs)