预期的标识符?视觉基础

时间:2015-04-01 23:59:28

标签: vb.net

我几乎完成了这个,然后...希望有人能够帮助我(真的希望至少,我需要完成这个:P)(需要更多的文本cus有很多代码) :

|error is there|>    
        Private Sub FlatButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FlatButton1_Click. <|error is there|

        Dim Conn As New MySqlConnection("Not going to publish this")

        If FlatTextBox1.Text = "" Then
            MsgBox("No username specified")
            FlatTextBox2.Text = ""
        Else
            If FlatTextBox2.Text = "" Then
                MsgBox("No password specified")
                FlatTextBox1.Text = ""
            Else
                Try
                    Me.Text = "Logging in..."
                    Conn.Open()
                    Dim sqlquery As String = "SELECT * FROM Testing WHERE Username = '" & FlatTextBox1.Text & "';"
                    Dim data As MySqlDataReader
                    Dim adapter As New MySqlDataAdapter
                    Dim command As New MySqlCommand
                    command.CommandText = sqlquery
                    command.Connection = Conn
                    adapter.SelectCommand = command
                    data = command.ExecuteReader
                    While data.Read()
                        If data.HasRows() = True Then
                            If data(2).ToString = FlatTextBox2.Text Then
                                Me.Text = "Logged in!"
                                My.Settings.Username = FlatTextBox1.Text
                                MsgBox("Welcome " + data(1).ToString)
                                Home.Show()
                                Me.Close()
                                If data(3).ToString = "1" Then
                                    My.Settings.Admin = "Yes"
                                Else
                                    My.Settings.Admin = "No"
                                End If
                            End If
                        Else
                            MsgBox("Failed Login")
                        End If
                    End While

                Catch ex As Exception

                End Try
            End If
        End If
    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

替换这些行

  

Private Sub FlatButton1_Click(ByVal sender As System.Object,ByVal e   As System.EventArgs)处理FlatButton1_Click

Private Sub FlatButton1_Click(sender As Object, e As EventArgs) Handles FlatButton1_Click